potoki-2.0.6: Simple streaming in IO

Safe HaskellNone
LanguageHaskell2010

Potoki.Consume

Synopsis

Documentation

data Consume input output #

Active consumer of input into output. Sort of like a reducer in Map/Reduce.

Automates the management of resources.

transform :: Transform input1 input2 -> Consume input2 output -> Consume input1 output #

count :: Consume input Int #

sum :: Num num => Consume num num #

head :: Consume input (Maybe input) #

last :: Consume input (Maybe input) #

list :: Consume input [input] #

reverseList :: Consume input [input] #

A faster alternative to "list", which however constructs the list in the reverse order.

vector :: Consume input (Vector input) #

concat :: (Semigroup monoid, Monoid monoid) => Consume monoid monoid #

fold :: Fold input output -> Consume input output #

foldInIO :: FoldM IO input output -> Consume input output #

folding :: Fold a b -> Consume a c -> Consume a (b, c) #

foldingInIO :: FoldM IO a b -> Consume a c -> Consume a (b, c) #

execState :: (a -> State s b) -> s -> Consume a s #

writeBytesToFile :: FilePath -> Consume ByteString (Either IOException ()) #

Overwrite a file.

  • Exception-free
  • Automatic resource management

appendBytesToFile :: FilePath -> Consume ByteString (Either IOException ()) #

Append to a file.

  • Exception-free
  • Automatic resource management

parseText :: Parser output -> Consume Text (Either Text output) #

concurrently :: Int -> Consume a b -> Consume b c -> Consume a c #

Execute a Consume concurrently and consume its results.