Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Documentation
takeBalancedC :: 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