potoki-core-2.2.1.1: Low-level components of "potoki"

Safe HaskellNone
LanguageHaskell2010

Potoki.Core.Consume

Contents

Synopsis

Documentation

newtype Consume input output Source #

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

Automates the management of resources.

Constructors

Consume (Fetch input -> IO output)

An action, which executes the provided fetch in IO, while managing the resources behind the scenes.

Instances
Choice Consume # 
Instance details

Defined in Potoki.Core.Consume

Methods

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

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

Profunctor Consume # 
Instance details

Defined in Potoki.Core.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 => q b c -> Consume a b -> Consume a c #

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

Monad (Consume a) # 
Instance details

Defined in Potoki.Core.Consume

Methods

(>>=) :: Consume a a0 -> (a0 -> Consume a b) -> Consume a b #

(>>) :: Consume a a0 -> Consume a b -> Consume a b #

return :: a0 -> Consume a a0 #

fail :: String -> Consume a a0 #

Functor (Consume input) # 
Instance details

Defined in Potoki.Core.Consume

Methods

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

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

Applicative (Consume a) # 
Instance details

Defined in Potoki.Core.Consume

Methods

pure :: a0 -> Consume a a0 #

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

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

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

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

MonadIO (Consume a) # 
Instance details

Defined in Potoki.Core.Consume

Methods

liftIO :: IO a0 -> Consume a a0 #

apConcurrently :: Consume a (b -> c) -> Consume a b -> Consume a c Source #

list :: Consume input [input] Source #

sum :: Num num => Consume num num Source #

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

head :: Consume input (Maybe input) Source #

last :: Consume input (Maybe input) Source #

reverseList :: Consume input [input] Source #

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

vector :: Consume input (Vector input) Source #

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

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

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

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

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

execState :: (a -> State s b) -> s -> Consume a s 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 #

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

Execute a Consume concurrently and consume its results.

Orphan instances

Choice Consume Source # 
Instance details

Methods

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

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

Profunctor Consume Source # 
Instance details

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 => q b c -> Consume a b -> Consume a c #

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

Monad (Consume a) Source # 
Instance details

Methods

(>>=) :: Consume a a0 -> (a0 -> Consume a b) -> Consume a b #

(>>) :: Consume a a0 -> Consume a b -> Consume a b #

return :: a0 -> Consume a a0 #

fail :: String -> Consume a a0 #

Functor (Consume input) Source # 
Instance details

Methods

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

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

Applicative (Consume a) Source # 
Instance details

Methods

pure :: a0 -> Consume a a0 #

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

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

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

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

MonadIO (Consume a) Source # 
Instance details

Methods

liftIO :: IO a0 -> Consume a a0 #