Copyright | (c) 2021 Juan Pablo Royo Sales |
---|---|
License | BSD3 |
Maintainer | juanpablo.royo@gmail.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data ReadChannel a
- data WriteChannel a
- foldM :: MonadIO m => ReadChannel a -> (a -> m ()) -> m ()
- foldM' :: MonadIO m => ReadChannel a -> m () -> (a -> m ()) -> m ()
- push :: MonadIO m => a -> WriteChannel a -> m ()
- pull :: MonadIO m => ReadChannel a -> m (Maybe a)
- unfoldM :: forall m a b. MonadIO m => m a -> (a -> b) -> m Bool -> WriteChannel b -> m ()
- unfoldFile :: MonadIO m => FilePath -> WriteChannel b -> (ByteString -> b) -> m ()
- unfoldT :: (MonadIO m, Foldable t) => t a -> WriteChannel b -> (a -> b) -> m ()
- newChannel :: forall a. IO (WriteChannel a, ReadChannel a)
- end :: WriteChannel a -> IO ()
Documentation
data ReadChannel a Source #
ReadChannel
can only read values of a previously written Channel. It is connected to a WriteChannel
but hidden for the user
a
- Type that this Channel can read
data WriteChannel a Source #
WriteChannel
can only write values into some Channel Queue
a
- Type that this Channel can write
:: MonadIO m | |
=> ReadChannel a | |
-> (a -> m ()) | Computation to do with read element |
-> m () |
foldM
is a Catamorphism for consuming a ReadChannel
and do some Monadic m
computation with each element
:: MonadIO m | |
=> ReadChannel a | |
-> m () | Computation to do at the end of the channel |
-> (a -> m ()) | Computation to do with read element |
-> m () |
Idem foldM
but allows pass a monadic computation to perform at the end of the Channel
push :: MonadIO m => a -> WriteChannel a -> m () Source #
Push element a
into WriteChannel
pull :: MonadIO m => ReadChannel a -> m (Maybe a) Source #
Pull element Maybe a
from ReadChannel
:: forall m a b. MonadIO m | |
=> m a | Monadic Seed |
-> (a -> b) | Map input from seed to something to be written in Channel |
-> m Bool | When stop unfolding |
-> WriteChannel b |
|
-> m () |
Coalgebra with Monadic computation to Feed some WriteChannel
m
- Monadic computation wrapping Coalgebra
a
- Element get from some Source and to be write in some Channel
| unfold from a Monadic seed m a
to a WriteChannel
:: MonadIO m | |
=> FilePath | Seed |
-> WriteChannel b |
|
-> (ByteString -> b) | Transform |
-> m () |
Using unfoldM
, unfold from file
newChannel :: forall a. IO (WriteChannel a, ReadChannel a) Source #
Warning: INTERNAL USE
end :: WriteChannel a -> IO () Source #
Warning: INTERNAL USE