-- 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 0.12 module Potoki.Core.Fetch -- | Passive producer of elements. newtype Fetch element Fetch :: (IO (Maybe element)) -> Fetch element duplicate :: Fetch element -> IO (Fetch element, Fetch element) maybeRef :: IORef (Maybe a) -> Fetch a list :: IORef [element] -> Fetch element firstCachingSecond :: IORef b -> Fetch (a, b) -> Fetch a bothFetchingFirst :: IORef b -> Fetch a -> Fetch (a, b) rightHandlingLeft :: (left -> IO ()) -> Fetch (Either left right) -> Fetch right rightCachingLeft :: IORef (Maybe left) -> Fetch (Either left right) -> Fetch right eitherFetchingRight :: IORef (Maybe left) -> Fetch right -> Fetch (Either left right) signaling :: IO () -> IO () -> Fetch a -> Fetch a ioFetch :: IO (Fetch a) -> Fetch a instance GHC.Base.Functor Potoki.Core.Types.Fetch instance GHC.Base.Applicative Potoki.Core.Types.Fetch instance GHC.Base.Monad Potoki.Core.Types.Fetch instance GHC.Base.Alternative Potoki.Core.Types.Fetch instance GHC.Base.MonadPlus Potoki.Core.Types.Fetch instance Control.Monad.IO.Class.MonadIO Potoki.Core.Types.Fetch module Potoki.Core.Transform newtype Transform input output Transform :: (Fetch input -> Acquire (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.Types.Transform instance Data.Profunctor.Unsafe.Profunctor Potoki.Core.Types.Transform instance Data.Profunctor.Choice.Choice Potoki.Core.Types.Transform instance Data.Profunctor.Strong.Strong Potoki.Core.Types.Transform instance Control.Arrow.Arrow Potoki.Core.Types.Transform instance Control.Arrow.ArrowChoice Potoki.Core.Types.Transform module Potoki.Core.Produce -- | Passive producer of elements with support for early termination and -- resource management. newtype Produce element Produce :: (Acquire (Fetch element)) -> Produce element list :: [input] -> Produce input transform :: Transform input output -> Produce input -> Produce output instance GHC.Base.Functor Potoki.Core.Types.Produce instance GHC.Base.Applicative Potoki.Core.Types.Produce instance GHC.Base.Alternative Potoki.Core.Types.Produce instance GHC.Base.Monad Potoki.Core.Types.Produce instance Control.Monad.IO.Class.MonadIO Potoki.Core.Types.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 input1 input2 -> Consume input2 output -> Consume input1 output instance Data.Profunctor.Unsafe.Profunctor Potoki.Core.Types.Consume instance Data.Profunctor.Choice.Choice Potoki.Core.Types.Consume instance GHC.Base.Functor (Potoki.Core.Types.Consume input) instance GHC.Base.Applicative (Potoki.Core.Types.Consume a) instance GHC.Base.Monad (Potoki.Core.Types.Consume a) instance Control.Monad.IO.Class.MonadIO (Potoki.Core.Types.Consume a) 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 :: IO (Maybe input) -> Consume input output -> IO output -- | Fetch all the elements running the provided handler on them fetchAndHandleAll :: Fetch element -> IO () -> (element -> IO ()) -> IO () -- | Fetch and handle just one element fetchAndHandle :: Fetch element -> IO a -> (element -> IO a) -> IO a transformList :: Transform a b -> [a] -> IO [b]