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

Safe HaskellNone
LanguageHaskell2010

Potoki.Core.Produce

Contents

Synopsis

Documentation

newtype Produce element Source #

Passive producer of elements with support for early termination and resource management.

Constructors

Produce (Acquire (Fetch element)) 
Instances
Monad Produce # 
Instance details

Defined in Potoki.Core.Produce

Methods

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

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

return :: a -> Produce a #

fail :: String -> Produce a #

Functor Produce # 
Instance details

Defined in Potoki.Core.Produce

Methods

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

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

Applicative Produce # 
Instance details

Defined in Potoki.Core.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 # 
Instance details

Defined in Potoki.Core.Produce

Methods

empty :: Produce a #

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

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

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

MonadIO Produce # 
Instance details

Defined in Potoki.Core.Produce

Methods

liftIO :: IO a -> Produce a #

list :: [input] -> Produce input Source #

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

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.

Orphan instances

Monad Produce Source # 
Instance details

Methods

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

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

return :: a -> Produce a #

fail :: String -> Produce a #

Functor Produce Source # 
Instance details

Methods

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

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

Applicative Produce Source # 
Instance details

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 Source # 
Instance details

Methods

empty :: Produce a #

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

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

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

MonadIO Produce Source # 
Instance details

Methods

liftIO :: IO a -> Produce a #