Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Transform input output
- consume :: Consume input output -> Transform input output
- produce :: (input -> Produce output) -> Transform input output
- ioTransform :: IO (Transform a b) -> Transform a b
- take :: Int -> Transform input input
- takeWhile :: (input -> Bool) -> Transform input input
- drop :: Int -> Transform input input
- mapFilter :: (input -> Maybe output) -> Transform input output
- filter :: (input -> Bool) -> Transform input input
- just :: Transform (Maybe input) input
- list :: Transform [a] a
- vector :: Transform (Vector a) a
- distinctBy :: (Eq comparable, Hashable comparable) => (element -> comparable) -> Transform element element
- distinct :: (Eq element, Hashable element) => Transform element element
- executeIO :: Transform (IO a) a
- mapInIO :: (a -> IO b) -> Transform a b
- builderChunks :: Transform Builder ByteString
- extractLines :: Transform ByteString ByteString
- extractLinesWithoutTrail :: Transform ByteString ByteString
- runState :: (input -> State state output) -> state -> Transform input (output, state)
- execState :: (input -> State state output) -> state -> Transform input state
- evalState :: (input -> State state output) -> state -> Transform input output
- parseBytes :: Parser parsed -> Transform ByteString (Either Text parsed)
- parseText :: Parser parsed -> Transform Text (Either Text parsed)
- parseLineBytesConcurrently :: Int -> Parser a -> Transform ByteString (Either Text a)
- parseNonEmptyLineBytesConcurrently :: Int -> Parser a -> Transform ByteString (Either Text a)
- bufferize :: Int -> Transform element element
- concurrently :: Int -> Transform input output -> Transform input output
- async :: Int -> Transform input input
- deleteFile :: Transform FilePath (Either IOException ())
- appendBytesToFile :: Transform (FilePath, ByteString) (Either IOException ())
- writeTextToFile :: Transform (FilePath, Text) (Either IOException ())
- traceWithCounter :: (Int -> String) -> Transform a a
Documentation
Potoki integration
Basics
ioTransform :: IO (Transform a b) -> Transform a b #
distinctBy :: (Eq comparable, Hashable comparable) => (element -> comparable) -> Transform element element #
ByteString
extractLines :: Transform ByteString ByteString #
Convert freeform bytestring chunks into chunks, which are strictly separated by newline no matter how long they may be.
State
runState :: (input -> State state output) -> state -> Transform input (output, state) #
Notice that you can control the emission of output of each step by producing a list of outputs and then composing the transform with the "list" transform.
Parsing
parseBytes :: Parser parsed -> Transform ByteString (Either Text parsed) #
Lift an Attoparsec ByteString parser.
parseLineBytesConcurrently :: Int -> Parser a -> Transform ByteString (Either Text a) #
Lift an Attoparsec ByteString parser to a transform, which parses the lines concurrently.
parseNonEmptyLineBytesConcurrently :: Int -> Parser a -> Transform ByteString (Either Text a) #
Lift an Attoparsec ByteString parser to a transform, which parses the lines concurrently.
Concurrency
concurrently :: Int -> Transform input output -> Transform input output #
Execute the transform on the specified amount of threads. The order of the outputs produced is indiscriminate.
async :: Int -> Transform input input #
A transform, which fetches the inputs asynchronously on the specified number of threads.
File IO
deleteFile :: Transform FilePath (Either IOException ()) #
appendBytesToFile :: Transform (FilePath, ByteString) (Either IOException ()) #
writeTextToFile :: Transform (FilePath, Text) (Either IOException ()) #
Debugging
traceWithCounter :: (Int -> String) -> Transform a a #
Useful for debugging