Safe Haskell | None |
---|---|
Language | Haskell2010 |
Runs computations depending on some values coming from a conduit. The computations are defined in applicative fashion.
test :: IO [Int] test = inp =$ cnd $$ CL.consume where inp = sourceDirectory "/etc" cnd :: Conduit String IO Int cnd = withRequirement (map Once comps) id (fmap length . readFile) comps :: [Require String Int Int] comps = [ (+) <$> require "/etc/passwd" <*> require "/etc/passwd" , (-) <$> require "/etc/resolv.conf" <*> require "/etc/nonexistent" , require "/etc/hosts" ]
Documentation
:: (Ord identifier, Eq identifier, Monad m, Functor m) | |
=> [(RunMode, Require identifier content x)] | The list of dependent computations |
-> (a -> identifier) | Extracting the identifier |
-> (a -> m content) | Extracting the content, possibly with effects |
-> Conduit a m x |
Given a stream of values, from which an identifier and a content can be extracted, runs a list of computation that depend on these.
Each computation's output is yield
ed downstream.
When all computations have been run, the conduit finishes processing.