From a8f524d742a7b774e7fd1fb26fa196a7a0bcde79 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 23 Sep 2023 00:57:33 -0500 Subject: [PATCH] lerox: and_maybe is actually and_either with g = identity function --- lerox/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerox/src/lib.rs b/lerox/src/lib.rs index 95c60c9..938910b 100644 --- a/lerox/src/lib.rs +++ b/lerox/src/lib.rs @@ -27,7 +27,7 @@ pub trait Combinator: Combinable + Sized { /// Returns the result of running f on self, or if it fails, the original self fn and_maybe(self, f: impl Fn(Self) -> Self) -> Self where Self: Clone { - self.clone().and(f).or(|_| self) + self.and_either(f, |g| g) } /// Returns the result of running f on self, or if it fails, runs g on self