potoki-0.7.2: Simple streaming in IO

Safe HaskellNone
LanguageHaskell2010

Potoki.Produce

Synopsis

Documentation

data Produce element :: * -> * #

Passive producer of elements with support for early termination.

Automates the management of resources.

Instances

Functor Produce 

Methods

fmap :: (a -> b) -> Produce a -> Produce b #

(<$) :: a -> Produce b -> Produce a #

Applicative Produce 

Methods

pure :: a -> Produce a #

(<*>) :: Produce (a -> b) -> Produce a -> Produce b #

liftA2 :: (a -> b -> c) -> Produce a -> Produce b -> Produce c #

(*>) :: Produce a -> Produce b -> Produce b #

(<*) :: Produce a -> Produce b -> Produce a #

Alternative Produce 

Methods

empty :: Produce a #

(<|>) :: Produce a -> Produce a -> Produce a #

some :: Produce a -> Produce [a] #

many :: Produce a -> Produce [a] #

transform :: Transform input output -> Produce input -> Produce output Source #

list :: [input] -> Produce input #

vector :: Vector input -> Produce input Source #

fileBytes :: FilePath -> Produce (Either IOException ByteString) Source #

Read from a file by path.

  • Exception-free
  • Automatic resource management

fileBytesAtOffset :: FilePath -> Int -> Produce (Either IOException ByteString) Source #

Read from a file by path.

  • Exception-free
  • Automatic resource management

fileText :: FilePath -> Produce (Either IOException Text) Source #

Read from a file by path.

  • Exception-free
  • Automatic resource management

directoryContents :: FilePath -> Produce (Either IOException FilePath) Source #

Sorted subpaths of the directory.

finiteMVar :: MVar (Maybe element) -> Produce element Source #

Read from MVar. Nothing gets interpreted as the end of input.

infiniteMVar :: MVar element -> Produce element Source #

Read from MVar. Never stops.