Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Consume input output = Consume (Fetch input -> IO output)
- apConcurrently :: Consume a (b -> c) -> Consume a b -> Consume a c
- list :: Consume input [input]
- sum :: Num num => Consume num num
- transform :: Transform input1 input2 -> Consume input2 output -> Consume input1 output
- count :: Consume input Int
- head :: Consume input (Maybe input)
- last :: Consume input (Maybe input)
- reverseList :: Consume input [input]
- 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
- writeBytesToStdout :: Consume ByteString ()
- writeBytesToFile :: FilePath -> Consume ByteString (Either IOException ())
- writeBytesToFileWithoutBuffering :: FilePath -> Consume ByteString (Either IOException ())
- appendBytesToFile :: FilePath -> Consume ByteString (Either IOException ())
- deleteFiles :: Consume FilePath (Either IOException ())
- printBytes :: Consume ByteString ()
- printText :: Consume Text ()
- printString :: Consume String ()
- parseBytes :: Parser output -> Consume ByteString (Either Text output)
- parseText :: Parser output -> Consume Text (Either Text output)
- concurrently :: Int -> Consume a b -> Consume b c -> Consume a c
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.
Consume (Fetch input -> IO output) | An action, which executes the provided fetch in IO, while managing the resources behind the scenes. |
Instances
Choice Consume # | |
Profunctor Consume # | |
Defined in Potoki.Core.Consume | |
Monad (Consume a) # | |
Functor (Consume input) # | |
Applicative (Consume a) # | |
MonadIO (Consume a) # | |
Defined in Potoki.Core.Consume |
reverseList :: Consume input [input] Source #
A faster alternative to "list", which however constructs the list in the reverse order.
writeBytesToFile :: FilePath -> Consume ByteString (Either IOException ()) Source #
Overwrite a file.
- Exception-free
- Automatic resource management
writeBytesToFileWithoutBuffering :: FilePath -> Consume ByteString (Either IOException ()) Source #
A more efficient implementation than just writing to file without buffering. It uses an explicit buffer of input chunks and flushes all the chunks that have been so far aggregated at once.
appendBytesToFile :: FilePath -> Consume ByteString (Either IOException ()) Source #
Append to a file.
- Exception-free
- Automatic resource management
deleteFiles :: Consume FilePath (Either IOException ()) Source #
printBytes :: Consume ByteString () Source #
printString :: Consume String () Source #
parseBytes :: Parser output -> Consume ByteString (Either Text output) Source #
concurrently :: Int -> Consume a b -> Consume b c -> Consume a c Source #
Execute a Consume concurrently and consume its results.