-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Low-level components of "potoki" -- -- Provides everything required for building custom instances of the -- "potoki" abstractions. Consider this library to be the Internals -- modules of "potoki". @package potoki-core @version 1.4 module Potoki.Core.Fetch -- | Passive producer of elements. newtype Fetch element -- | Something close to a Church encoding of IO (Maybe element). Fetch :: (forall x. x -> (element -> x) -> IO x) -> Fetch element duplicate :: Fetch element -> IO (Fetch element, Fetch element) list :: IORef [element] -> Fetch element firstCachingSecond :: IORef (Maybe b) -> Fetch (a, b) -> Fetch a bothFetchingFirst :: IORef (Maybe b) -> Fetch a -> Fetch (a, b) instance GHC.Base.Functor Potoki.Core.Fetch.Fetch instance GHC.Base.Applicative Potoki.Core.Fetch.Fetch instance GHC.Base.Monad Potoki.Core.Fetch.Fetch instance GHC.Base.Alternative Potoki.Core.Fetch.Fetch instance GHC.Base.MonadPlus Potoki.Core.Fetch.Fetch module Potoki.Core.Produce -- | Passive producer of elements with support for early termination. -- -- Automates the management of resources. newtype Produce element Produce :: (IO (Fetch element, IO ())) -> Produce element list :: [input] -> Produce input transform :: Transform input output -> Produce input -> Produce output instance GHC.Base.Functor Potoki.Core.Produce.Produce instance GHC.Base.Applicative Potoki.Core.Produce.Produce instance GHC.Base.Alternative Potoki.Core.Produce.Produce module Potoki.Core.Consume -- | Active consumer of input into output. Sort of like a reducer in -- Map/Reduce. -- -- Automates the management of resources. newtype Consume input output -- | An action, which executes the provided fetch in IO, while managing the -- resources behind the scenes. Consume :: (Fetch input -> IO output) -> Consume input output apConcurrently :: Consume a (b -> c) -> Consume a b -> Consume a c list :: Consume input [input] sum :: Num num => Consume num num transform :: Transform input output -> Consume output sinkOutput -> Consume input sinkOutput instance Data.Profunctor.Unsafe.Profunctor Potoki.Core.Consume.Consume instance Data.Profunctor.Choice.Choice Potoki.Core.Consume.Consume instance GHC.Base.Functor (Potoki.Core.Consume.Consume input) instance GHC.Base.Applicative (Potoki.Core.Consume.Consume a) instance GHC.Base.Monad (Potoki.Core.Consume.Consume a) instance Control.Monad.IO.Class.MonadIO (Potoki.Core.Consume.Consume a) module Potoki.Core.Transform newtype Transform input output Transform :: (Fetch input -> IO (Fetch output)) -> Transform input output consume :: Consume input output -> Transform input output produce :: (input -> Produce output) -> Transform input output mapFetch :: (Fetch a -> Fetch b) -> Transform a b -- | Execute the IO action. executeIO :: Transform (IO a) a take :: Int -> Transform input input instance Control.Category.Category Potoki.Core.Transform.Types.Transform instance Data.Profunctor.Unsafe.Profunctor Potoki.Core.Transform.Types.Transform instance Data.Profunctor.Choice.Choice Potoki.Core.Transform.Types.Transform instance Data.Profunctor.Strong.Strong Potoki.Core.Transform.Types.Transform instance Control.Arrow.Arrow Potoki.Core.Transform.Types.Transform instance Control.Arrow.ArrowChoice Potoki.Core.Transform.Types.Transform module Potoki.Core.IO produceAndConsume :: Produce input -> Consume input output -> IO output produceAndTransformAndConsume :: Produce input -> Transform input anotherInput -> Consume anotherInput output -> IO output produce :: Produce input -> forall x. IO x -> (input -> IO x) -> IO x consume :: (forall x. x -> (input -> x) -> IO x) -> Consume input output -> IO output -- | Fetch all the elements running the provided handler on them fetchAndHandleAll :: Fetch element -> IO () -> (element -> IO ()) -> IO () -- | Fetch just one element fetch :: Fetch element -> IO (Maybe element)