-
Notifications
You must be signed in to change notification settings - Fork 200
Open
Description
A specialized version of mapAccumWhile that keeps folding as long as the function argument returns 'Right'
foldWhile :: (Monad m) => (a -> s -> Either s s) -> s -> C.ConduitT a o m s
foldWhile f = loop
where
loop !s = C.await >>= maybe (pure s) go
where
go a = either (return $!) loop $ f a s
Metadata
Metadata
Assignees
Labels
No labels