>>> toEither = Maybe.maybe (Left "maybe: predicate failed") Right >>> maybe f = Parser.either (toEither . f)
>>> maybe f = Parser.fromFoldMaybe "maybe: predicate failed" (Fold.maybe f)Pre-release
>>> mapMaybe f = Fold.lmap f . Fold.catMaybes >>> mapMaybe f = Fold.mapMaybeM (return . f)
>>> f x = if even x then Just x else Nothing >>> fld = Fold.mapMaybe f Fold.toList >>> Stream.fold fld (Stream.enumerateFromTo 1 10) [2,4,6,8,10]
>>> scanMaybe p f = Fold.postscan p (Fold.catMaybes f)Pre-release
>>> mapMaybeM f = Stream.catMaybes . Stream.mapM f
>>> mapM f = Stream.mapMaybeM (\x -> Just <$> f x)
>>> scanMaybe f = Stream.catMaybes . Stream.postscan f
>>> mapMaybeM f = Fold.lmapM f . Fold.catMaybes