| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
CfnFlip.Conduit
Documentation
takeBalancedC :: forall (m :: Type -> Type) a. Monad m => (a -> Bool) -> (a -> Bool) -> ConduitT a a m () Source #
Take until an ending element, including any reopened-ended in between
>>>:{runIdentity $ runConduit $ yieldMany "this is (a thing) here) and more" .| takeBalancedC (== '(') (==')') .| sinkList :} "this is (a thing) here)"
Note that imbalance will terminate early,
>>>:{runIdentity $ runConduit $ yieldMany "this is, a) unexpected but b) the best we can do)" .| takeBalancedC (== '(') (==')') .| sinkList :} "this is, a)"
Or just run to the end
>>>:{runIdentity $ runConduit $ yieldMany "this is (pretty unlikely" .| takeBalancedC (== '(') (==')') .| sinkList :} "this is (pretty unlikely"
module Conduit