-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Reactively combines Producers so that a value is yielded as soon as possible.
--   
--   Reactively combines Producers so that a value is yielded as soon as
--   possible.
@package pipes-fluid
@version 0.6.0.1

module Pipes.Fluid.Merge

-- | Differentiates whether a value from either or both producers. In the
--   case of one producer, additional identify if the other producer is
--   live or dead.
data Source
FromBoth :: Source
FromLeft :: OtherStatus -> Source
FromRight :: OtherStatus -> Source

-- | The other producer can be live (still yielding values), or dead
data OtherStatus
OtherLive :: OtherStatus
OtherDead :: OtherStatus

-- | Differentiates when only one side is available (due to initial merge
--   values of Nothing) or if two values (one of which may be a previous
--   values) are availabe.
data Merged a b
Coupled :: Source -> a -> b -> Merged a b
LeftOnly :: OtherStatus -> a -> Merged a b
RightOnly :: OtherStatus -> b -> Merged a b

-- | This can be used with <a>takeWhile</a>
isBothLive :: Merged x y -> Bool

-- | This can be used with <a>takeWhile</a>
isLeftLive :: Merged x y -> Bool

-- | This can be used with <a>takeWhile</a>
isRightLive :: Merged x y -> Bool

-- | This can be used with <a>takeWhile</a>
isRightDead :: Merged x y -> Bool

-- | This can be used with <a>takeWhile</a>
isLeftDead :: Merged x y -> Bool
class Merge f
merge' :: Merge f => Maybe x -> Maybe y -> f x -> f y -> f (Merged x y)
merge :: Merge f => f x -> f y -> f (Merged x y)

-- | Keep only the values originated from the left, replacing other yields
--   with Nothing. This is useful when React is based on STM, since
--   filtering with Producer STM results in larger STM transactions which
--   may result in blocking.
discreteLeft :: Merged x y -> Maybe x

-- | Keep only the values originated from the right, replacing other yields
--   with Nothing. This is useful when React is based on STM, since
--   filtering with Producer STM results in larger STM transactions which
--   may result in blocking.
discreteRight :: Merged x y -> Maybe y

-- | Keep only the values originated from both, replacing other yields with
--   Nothing. This is useful when React is based on STM, since filtering
--   with Producer STM results in larger STM transactions which may result
--   in blocking.
discreteBoth :: Merged x y -> Maybe (x, y)

-- | Keep only the "new" values
discrete' :: Merged x x -> NonEmpty x

-- | Keep only the "new" values (using semigroup &lt;&gt; when both values
--   were active)
discrete :: Semigroup x => Merged x x -> x

-- | merge two producers of the same type together.
mergeDiscrete' :: (Merge f, Functor f) => f x -> f x -> f (NonEmpty x)

-- | merge two producers of the same type together (using semigroup
--   &lt;&gt; when both values were active)
mergeDiscrete :: (Semigroup x, Merge f, Functor f) => f x -> f x -> f x
instance GHC.Generics.Generic (Pipes.Fluid.Merge.Merged a b)
instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (Pipes.Fluid.Merge.Merged a b)
instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Pipes.Fluid.Merge.Merged a b)
instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (Pipes.Fluid.Merge.Merged a b)
instance GHC.Generics.Generic Pipes.Fluid.Merge.Source
instance GHC.Classes.Ord Pipes.Fluid.Merge.Source
instance GHC.Show.Show Pipes.Fluid.Merge.Source
instance GHC.Classes.Eq Pipes.Fluid.Merge.Source
instance GHC.Generics.Generic Pipes.Fluid.Merge.OtherStatus
instance GHC.Classes.Ord Pipes.Fluid.Merge.OtherStatus
instance GHC.Show.Show Pipes.Fluid.Merge.OtherStatus
instance GHC.Classes.Eq Pipes.Fluid.Merge.OtherStatus

module Pipes.Fluid.ImpulseIO

-- | The applicative instance of this combines multiple Producers
--   reactively ie, yields a value as soon as either or both of the input
--   producers yields a value. This creates two threads each time this
--   combinator is used. Warning: This means that the monadic effects are
--   run in isolation from each other so if the monad is something like
--   (StateT s IO), then the state will alternate between the two input
--   producers, which is most likely not what you want.
newtype ImpulseIO m a
ImpulseIO :: Producer a m () -> ImpulseIO m a
[impulsivelyIO] :: ImpulseIO m a -> Producer a m ()
instance (Pipes.Fluid.ImpulseIO.ImpulseIO m1 a1 ~ t) => Control.Lens.Wrapped.Rewrapped (Pipes.Fluid.ImpulseIO.ImpulseIO m2 a2) t
instance Control.Lens.Wrapped.Wrapped (Pipes.Fluid.ImpulseIO.ImpulseIO m a)
instance (Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m, Data.Constraint.Forall.Forall (Control.Concurrent.Async.Lifted.Safe.Pure m), GHC.Base.Semigroup a) => GHC.Base.Semigroup (Pipes.Fluid.ImpulseIO.ImpulseIO m a)
instance (Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m, Data.Constraint.Forall.Forall (Control.Concurrent.Async.Lifted.Safe.Pure m), GHC.Base.Semigroup a) => GHC.Base.Monoid (Pipes.Fluid.ImpulseIO.ImpulseIO m a)
instance GHC.Base.Monad m => GHC.Base.Functor (Pipes.Fluid.ImpulseIO.ImpulseIO m)
instance (Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m, Data.Constraint.Forall.Forall (Control.Concurrent.Async.Lifted.Safe.Pure m)) => GHC.Base.Applicative (Pipes.Fluid.ImpulseIO.ImpulseIO m)
instance (Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO m, Data.Constraint.Forall.Forall (Control.Concurrent.Async.Lifted.Safe.Pure m)) => Pipes.Fluid.Merge.Merge (Pipes.Fluid.ImpulseIO.ImpulseIO m)

module Pipes.Fluid.Impulse

-- | The applicative instance of this combines multiple Producers
--   reactively ie, yields a value as soon as either or both of the input
--   producers yields a value.
newtype Impulse m a
Impulse :: Producer a m () -> Impulse m a
[impulsively] :: Impulse m a -> Producer a m ()
instance (Pipes.Fluid.Impulse.Impulse m1 a1 ~ t) => Control.Lens.Wrapped.Rewrapped (Pipes.Fluid.Impulse.Impulse m2 a2) t
instance Control.Lens.Wrapped.Wrapped (Pipes.Fluid.Impulse.Impulse m a)
instance (GHC.Base.Alternative m, GHC.Base.Monad m, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Pipes.Fluid.Impulse.Impulse m a)
instance (GHC.Base.Alternative m, GHC.Base.Monad m, GHC.Base.Semigroup a) => GHC.Base.Monoid (Pipes.Fluid.Impulse.Impulse m a)
instance GHC.Base.Monad m => GHC.Base.Functor (Pipes.Fluid.Impulse.Impulse m)
instance (GHC.Base.Alternative m, GHC.Base.Monad m) => GHC.Base.Applicative (Pipes.Fluid.Impulse.Impulse m)
instance (GHC.Base.Alternative m, GHC.Base.Monad m) => Pipes.Fluid.Merge.Merge (Pipes.Fluid.Impulse.Impulse m)

module Pipes.Fluid.Simultaneous

-- | The applicative instance of this combines multiple Producers
--   synchronously ie, yields a value only when both of the input producers
--   yields a value. Ends as soon as any of the input producer is ended.
newtype Simultaneous m a
Simultaneous :: Producer a m () -> Simultaneous m a
[simultaneously] :: Simultaneous m a -> Producer a m ()
instance (Pipes.Fluid.Simultaneous.Simultaneous m1 a1 ~ t) => Control.Lens.Wrapped.Rewrapped (Pipes.Fluid.Simultaneous.Simultaneous m2 a2) t
instance Control.Lens.Wrapped.Wrapped (Pipes.Fluid.Simultaneous.Simultaneous m a)
instance GHC.Base.Monad m => GHC.Base.Functor (Pipes.Fluid.Simultaneous.Simultaneous m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Pipes.Fluid.Simultaneous.Simultaneous m)
instance GHC.Base.Monad m => GHC.Base.Monad (Pipes.Fluid.Simultaneous.Simultaneous m)

module Pipes.Fluid
