Copyright | (c) Lars Brünjes, 2016 |
---|---|
License | MIT |
Maintainer | brunjlar@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Extensions |
|
This module provides various utilities for working with pipes.
- chunks :: Monad m => Int -> Pipe a [a] m ()
- fromFile :: (MonadSafe m, MonadIO m) => FilePath -> Producer' ByteString m ()
- toWord8 :: Monad m => Pipe ByteString Word8 m ()
- class (MonadCatch m, MonadMask m, MonadIO m, MonadIO (Base m)) => MonadSafe m
- runSafeP :: (MonadMask m, MonadIO m) => Effect (SafeT m) r -> Effect' m r
- runSafeT :: (MonadMask m, MonadIO m) => SafeT m r -> m r
- data ByteString :: *
- data Word8 :: *
Documentation
chunks :: Monad m => Int -> Pipe a [a] m () Source #
Collects upstream data in chunks of a specified size and then passes those chunks downstram.
>>>
import qualified Pipes.Prelude as P
>>>
runEffect $ each [1 .. 10 :: Int] >-> chunks 3 >-> P.mapM_ print
[1,2,3] [4,5,6] [7,8,9]
>>>
runEffect $ each [1 .. 30000 :: Int] >-> chunks 10000 >-> P.mapM_ (print . sum)
50005000 150005000 250005000
fromFile :: (MonadSafe m, MonadIO m) => FilePath -> Producer' ByteString m () Source #
Safely produces ByteString
s from a file.
toWord8 :: Monad m => Pipe ByteString Word8 m () Source #
Converts a stream of ByteString
s into a stream of Word8
s.
class (MonadCatch m, MonadMask m, MonadIO m, MonadIO (Base m)) => MonadSafe m #
MonadSafe m => MonadSafe (CatchT m) | |
(MonadIO m, MonadCatch m, MonadMask m) => MonadSafe (SafeT m) | |
MonadSafe m => MonadSafe (IdentityT * m) | |
MonadSafe m => MonadSafe (StateT s m) | |
MonadSafe m => MonadSafe (StateT s m) | |
(MonadSafe m, Monoid w) => MonadSafe (WriterT w m) | |
(MonadSafe m, Monoid w) => MonadSafe (WriterT w m) | |
MonadSafe m => MonadSafe (ReaderT * i m) | |
(MonadSafe m, Monoid w) => MonadSafe (RWST i w s m) | |
(MonadSafe m, Monoid w) => MonadSafe (RWST i w s m) | |
MonadSafe m => MonadSafe (Proxy a' a b' b m) | |
runSafeT :: (MonadMask m, MonadIO m) => SafeT m r -> m r #
Run the SafeT
monad transformer, executing all unreleased finalizers at
the end of the computation
data ByteString :: * #
A space-efficient representation of a Word8
vector, supporting many
efficient operations.
A ByteString
contains 8-bit bytes, or by using the operations from
Data.ByteString.Char8 it can be interpreted as containing 8-bit
characters.
8-bit unsigned integer type
Bounded Word8 | |
Enum Word8 | |
Eq Word8 | |
Integral Word8 | |
Num Word8 | |
Ord Word8 | |
Read Word8 | |
Real Word8 | |
Show Word8 | |
Ix Word8 | |
Lift Word8 | |
Random Word8 | |
NFData Word8 | |
Mode Word8 | |
PrintfArg Word8 | |
Storable Word8 | |
Bits Word8 | |
FiniteBits Word8 | |
Hashable Word8 | |
Prim Word8 | |
Unbox Word8 | |
IArray UArray Word8 | |
Vector Vector Word8 | |
MVector MVector Word8 | |
MArray (STUArray s) Word8 (ST s) | |
type Scalar Word8 | |
data Vector Word8 | |
data MVector s Word8 | |