Safe Haskell | None |
---|---|
Language | Haskell98 |
- newtype Fold1 b e a = Fold1 {}
- data Fold1_ b e a
- nonexhaustiveCont :: Fold1_ b e a -> Producer b IO () -> IO (Either e a)
- exhaustiveCont :: Fold1_ b e a -> Producer b IO r -> IO (Either e (a, r))
- withFallibleCont :: (Producer b IO () -> IO (Either e a)) -> Fold1 b e a
- withFallibleCont' :: (forall r. Producer b IO r -> IO (Either e (a, r))) -> Fold1 b e a
- withCont :: (Producer b IO () -> IO a) -> Fold1 b e a
- withCont' :: (forall r. Producer b IO r -> IO (a, r)) -> Fold1 b e a
- withStreamCont :: (Stream (Of b) IO () -> IO a) -> Fold1 b e a
- withStreamCont' :: (forall r. Stream (Of b) IO r -> IO (a, r)) -> Fold1 b e a
- withFallibleStreamCont :: (Stream (Of b) IO () -> IO (Either e a)) -> Fold1 b e a
- withFallibleStreamCont' :: (forall r. Stream (Of b) IO r -> IO (Either e (a, r))) -> Fold1 b e a
- withFold :: Fold b a -> Fold1 b e a
- withFoldIO :: FoldM IO b a -> Fold1 b e a
- hoistFold :: Monad m => (forall a. m a -> n a) -> FoldM m i r -> FoldM n i r
- withFallibleFold :: FoldM (ExceptT e IO) b a -> Fold1 b e a
- withConsumer :: Consumer b IO () -> Fold1 b e ()
- withConsumer' :: Consumer b IO Void -> Fold1 b e ()
- withConsumerM :: MonadIO m => (m () -> IO (Either e a)) -> Consumer b m () -> Fold1 b e a
- withConsumerM' :: MonadIO m => (forall r. m r -> IO (Either e (a, r))) -> Consumer b m Void -> Fold1 b e a
- withSafeConsumer :: Consumer b (SafeT IO) Void -> Fold1 b e ()
- withFallibleConsumer :: Consumer b (ExceptT e IO) Void -> Fold1 b e ()
- withParser :: Parser b IO (Either e a) -> Fold1 b e a
- withParserM :: MonadIO m => (forall r. m (a, r) -> IO (Either e (c, r))) -> Parser b m a -> Fold1 b e c
- fold1Fallibly :: Fold1 b e a -> Producer b IO r -> IO (Either e (a, r))
- fold1 :: Fold1 b Void a -> Producer b IO r -> IO (a, r)
- data Transducer x b e a
- mapper :: (a -> b) -> Transducer Continuous a e b
- fallibleMapper :: (a -> Either e b) -> Transducer Continuous a e b
- mapperFoldable :: Foldable f => (a -> f b) -> Transducer Continuous a e b
- mapperEnumerable :: Enumerable f => (a -> f IO b) -> Transducer Continuous a e b
- transducer :: (forall r. Producer b IO r -> Producer a IO r) -> Transducer Continuous b e a
- fallibleTransducer :: (forall r. Producer b IO r -> Producer a IO (Either e r)) -> Transducer Continuous b e a
- delimit :: (forall r. Producer a IO r -> FreeT (Producer a' IO) IO r) -> Transducer Continuous b e a -> Transducer Delimited b e a'
- transduce1 :: Transducer Continuous b e a -> Fold1 a e r -> Fold1 b e r
- groups :: (forall r. Producer b IO r -> Producer b' IO r) -> Transducer Delimited a e b -> Transducer Delimited a e b'
- folds :: Fold1 b Void b' -> Transducer Delimited a e b -> Transducer Continuous a e b'
- data Delimited
- data Continuous
- concats :: Transducer Delimited a e b -> Transducer Continuous a e b
- intercalates :: Producer b IO () -> Transducer Delimited a e b -> Transducer Continuous a e b
- newtype Fold2 b1 b2 e a = Fold2 (Lift (Fold2_ b1 b2 e) a)
- data Fold2_ b1 b2 e a
- fold2Fallibly_ :: Fold2_ b1 b2 e a -> Producer b1 IO r1 -> Producer b2 IO r2 -> IO (Either e (a, r1, r2))
- fold2Fallibly :: Fold2 b1 b2 e a -> Producer b1 IO r1 -> Producer b2 IO r2 -> IO (Either e (a, r1, r2))
- fold2 :: Fold2 b1 b2 Void a -> Producer b1 IO r1 -> Producer b2 IO r2 -> IO (a, r1, r2)
- liftFirst :: Fold1 b1 e r1 -> Fold2 b1 b2 e r1
- liftSecond :: Fold1 b2 e r1 -> Fold2 b1 b2 e r1
- separated_ :: Fold1_ b1 e r1 -> Fold1_ b2 e r2 -> Fold2_ b1 b2 e (r1, r2)
- separated :: Fold1 b1 e r1 -> Fold1 b2 e r2 -> Fold2 b1 b2 e (r1, r2)
- combined :: Transducer Delimited b1 e x -> Transducer Delimited b2 e x -> Fold1 x e a -> Fold2 b1 b2 e a
Documentation
A computation in IO
that completely drains a Producer
of b
values,
returning a value of type a
, except when it fails early with an error of
type e
.
Bifunctor (Fold1 b) Source # |
|
Functor (Fold1 b e) Source # | |
Applicative (Fold1 b e) Source # |
|
Semigroup a => Semigroup (Fold1 b e a) Source # | |
(Monoid a, Semigroup a) => Monoid (Fold1 b e a) Source # | |
This function preserves the return type of the Stream
and can be more
efficient than its counterpart.
withFallibleStreamCont' Source #
This function preserves the return type of the Stream
and can be more
efficient than its counterpart.
fold1 :: Fold1 b Void a -> Producer b IO r -> IO (a, r) Source #
Run a Fold1
that never returns an error value (but which may still throw exceptions!)
data Transducer x b e a Source #
A transformation that takes the inputs of a Fold1
from type a
to type b
.
Optionally, the transformation may delimit groups of elements in the
stream. In that case the phantom type x
will be Delimited
. Otherwise, it will be
Continuous
.
M (b -> a) | |
F (b -> [a]) | |
P (forall r. Producer b IO r -> Producer a IO r) | |
PE (forall r. Producer b IO r -> Producer a IO (Either e r)) | |
S (forall r. Producer b IO r -> FreeT (Producer a IO) IO r) | |
SE (forall r. Producer b IO r -> FreeT (Producer a IO) IO (Either e r)) |
Bifunctor (Transducer x b) Source # | |
Functor (Transducer x b e) Source # | |
:: (a -> b) | |
-> Transducer Continuous a e b |
:: (a -> Either e b) | |
-> Transducer Continuous a e b |
:: Foldable f | |
=> (a -> f b) | |
-> Transducer Continuous a e b |
:: Enumerable f | |
=> (a -> f IO b) | |
-> Transducer Continuous a e b |
:: (forall r. Producer b IO r -> Producer a IO r) | |
-> Transducer Continuous b e a |
:: (forall r. Producer b IO r -> Producer a IO (Either e r)) | |
-> Transducer Continuous b e a |
:: (forall r. Producer a IO r -> FreeT (Producer a' IO) IO r) | |
-> Transducer Continuous b e a | |
-> Transducer Delimited b e a' |
Plug splitting functions from pipes-group
here.
transduce1 :: Transducer Continuous b e a -> Fold1 a e r -> Fold1 b e r Source #
Apply a Transducer
to a Fold1
.
:: (forall r. Producer b IO r -> Producer b' IO r) | |
-> Transducer Delimited a e b | |
-> Transducer Delimited a e b' |
Tweak each of the groups delimited by a Transducer
.
:: Fold1 b Void b' | |
-> Transducer Delimited a e b | |
-> Transducer Continuous a e b' |
data Continuous Source #
:: Transducer Delimited a e b | |
-> Transducer Continuous a e b |
:: Producer b IO () | |
-> Transducer Delimited a e b | |
-> Transducer Continuous a e b |
fold2Fallibly_ :: Fold2_ b1 b2 e a -> Producer b1 IO r1 -> Producer b2 IO r2 -> IO (Either e (a, r1, r2)) Source #
fold2Fallibly :: Fold2 b1 b2 e a -> Producer b1 IO r1 -> Producer b2 IO r2 -> IO (Either e (a, r1, r2)) Source #
Run a Fold2
.
fold2 :: Fold2 b1 b2 Void a -> Producer b1 IO r1 -> Producer b2 IO r2 -> IO (a, r1, r2) Source #
Run a Fold2
that never returns an error value (but which may still throw exceptions!)
liftSecond :: Fold1 b2 e r1 -> Fold2 b1 b2 e r1 Source #
separated :: Fold1 b1 e r1 -> Fold1 b2 e r2 -> Fold2 b1 b2 e (r1, r2) Source #
Consume the producers concurrently, each one independently of the other.
combined :: Transducer Delimited b1 e x -> Transducer Delimited b2 e x -> Fold1 x e a -> Fold2 b1 b2 e a Source #
Consume the producers concurrently, delimiting groups in each producer,
and writing the groups into a common Fold1
.
Possible use: find lines in two text producers and combine the lines in a single stream, preserving the integrity of each individual line.