potoki-0.6.5: 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.

Instances

Profunctor Consume 

Methods

dimap :: (a -> b) -> (c -> d) -> Consume b c -> Consume a d #

lmap :: (a -> b) -> Consume b c -> Consume a c #

rmap :: (b -> c) -> Consume a b -> Consume a c #

(#.) :: Coercible * c b => (b -> c) -> Consume a b -> Consume a c #

(.#) :: Coercible * b a => Consume b c -> (a -> b) -> Consume a c #

Choice Consume 

Methods

left' :: Consume a b -> Consume (Either a c) (Either b c) #

right' :: Consume a b -> Consume (Either c a) (Either c b) #

Functor (Consume input) 

Methods

fmap :: (a -> b) -> Consume input a -> Consume input b #

(<$) :: a -> Consume input b -> Consume input a #

Applicative (Consume input) 

Methods

pure :: a -> Consume input a #

(<*>) :: Consume input (a -> b) -> Consume input a -> Consume input b #

liftA2 :: (a -> b -> c) -> Consume input a -> Consume input b -> Consume input c #

(*>) :: Consume input a -> Consume input b -> Consume input b #

(<*) :: Consume input a -> Consume input b -> Consume input a #

transform :: Transform input output -> Consume output sinkOutput -> Consume input sinkOutput Source #

sum :: Num num => Consume num num #

head :: Consume input (Maybe input) Source #

list :: Consume input [input] #

reverseList :: Consume input [input] Source #

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

concat :: Monoid monoid => Consume monoid monoid Source #

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

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

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

Overwrite a file.

  • Exception-free
  • Automatic resource management

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

Append to a file.

  • Exception-free
  • Automatic resource management

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