-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Arrow based stream transducers
--
-- Stream processing library similar to pipe, couduit, machines. With
-- support of arrow combinatins, or the arrow notation. AFRP-like
-- utilities are also available.
@package machinecell
@version 1.0.0
module Control.Arrow.Machine.Types
-- | To get multiple outputs by one input, the Phase parameter is
-- introduced.
--
-- Once a value Feeded, the machine is Sweeped until it
-- Suspends.
data Phase
Feed :: Phase
Sweep :: Phase
Suspend :: Phase
type StepType a b c = a (Phase, b) (Phase, c, ProcessA a b c)
-- | The stream transducer arrow.
--
-- To construct ProcessA instances, use Plan, arr,
-- functions declared in Utils, or arrow combinations of them.
data ProcessA a b c
ProcessA :: StepType a b c -> ProcessA a b c
step :: ProcessA a b c -> StepType a b c
fit :: (Arrow a, Arrow a') => (forall p q. a p q -> a' p q) -> ProcessA a b c -> ProcessA a' b c
dimapStep :: Arrow a => (b -> c) -> (d -> e) -> StepType a c d -> StepType a b e
parStep :: (Monoid t4, Arrow t, Arrow a) => t (t2, t1) (t4, t5, a b c) -> t (t2, t3) (t4, t6, a b' c') -> t (t2, (t1, t3)) (t4, (t5, t6), a (b, b') (c, c'))
arrStep :: ArrowApply a => (b -> c) -> StepType a b c
compositeStep :: ArrowApply a => StepType a b d -> StepType a d c -> StepType a b c
compositeStep' :: ArrowApply a => Phase -> StepType a b d -> StepType a d c -> StepType a b c
instance Eq Phase
instance Show Phase
instance (ArrowApply a, ArrowLoop a) => ArrowLoop (ProcessA a)
instance ArrowApply a => ArrowChoice (ProcessA a)
instance ArrowApply a => Arrow (ProcessA a)
instance ArrowApply a => Category (ProcessA a)
instance Arrow a => Profunctor (ProcessA a)
instance Monoid Phase
module Control.Arrow.Machine.ArrowUtil
kleisli :: Monad m => (a -> m b) -> Kleisli m a b
kleisli0 :: Monad m => m b -> Kleisli m () b
kleisli2 :: Monad m => (a1 -> a2 -> m b) -> Kleisli m (a1, a2) b
kleisli3 :: Monad m => (a1 -> a2 -> a3 -> m b) -> Kleisli m (a1, a2, a3) b
kleisli4 :: Monad m => (a1 -> a2 -> a3 -> a4 -> m b) -> Kleisli m (a1, a2, a3, a4) b
kleisli5 :: Monad m => (a1 -> a2 -> a3 -> a4 -> a5 -> m b) -> Kleisli m (a1, a2, a3, a4, a5) b
module Control.Arrow.Machine.Event
class Occasional a where isOccasion x = not (isNoEvent x) && not (isEnd x)
noEvent :: Occasional a => a
end :: Occasional a => a
isNoEvent :: Occasional a => a -> Bool
isEnd :: Occasional a => a -> Bool
isOccasion :: Occasional a => a -> Bool
data Event a
Event :: a -> Event a
NoEvent :: Event a
End :: Event a
hEv :: ArrowApply a => a (e, b) c -> a e c -> a (e, Event b) c
hEv' :: ArrowApply a => a (e, b) c -> a e c -> a e c -> a (e, Event b) c
evMaybe :: Arrow a => c -> (b -> c) -> a (Event b) c
fromEvent :: Arrow a => b -> a (Event b) b
evMap :: Arrow a => (b -> c) -> a (Event b) (Event c)
split :: (Arrow a, Occasional b) => a (Event b) b
join :: (Arrow a, Occasional b) => a b (Event b)
split2 :: Event (Event a, Event b) -> (Event a, Event b)
join2 :: (Event a, Event b) -> Event (Event a, Event b)
instance Eq a => Eq (Event a)
instance Show a => Show (Event a)
instance MonadPlus Event
instance Monad Event
instance Alternative Event
instance Traversable Event
instance Foldable Event
instance Applicative Event
instance Functor Event
instance Occasional (Event a)
instance (Occasional a, Occasional b) => Occasional (a, b)
-- | A coroutine monad, inspired by machines library.
module Control.Arrow.Machine.Plan
type PlanT i o m a = FreeT (PlanF i o) m a
type Plan i o a = forall m. Monad m => PlanT i o m a
await :: Plan i o i
yield :: o -> Plan i o ()
stop :: Plan i o ()
stopped :: (ArrowApply a, Occasional c) => ProcessA a b c
constructT :: (Monad m, ArrowApply a) => (forall b. m b -> a () b) -> PlanT i o m r -> ProcessA a (Event i) (Event o)
repeatedlyT :: (Monad m, ArrowApply a) => (forall b. m b -> a () b) -> PlanT i o m r -> ProcessA a (Event i) (Event o)
construct :: ArrowApply a => Plan i o t -> ProcessA a (Event i) (Event o)
repeatedly :: ArrowApply a => Plan i o t -> ProcessA a (Event i) (Event o)
instance Functor (PlanF i o)
module Control.Arrow.Machine.Utils
delay :: (ArrowApply a, Occasional b) => ProcessA a b b
hold :: ArrowApply a => b -> ProcessA a (Event b) b
accum :: ArrowApply a => b -> ProcessA a (Event (b -> b)) b
edge :: (ArrowApply a, Eq b) => ProcessA a b (Event b)
passRecent :: (ArrowApply a, Occasional o) => ProcessA a e (Event b) -> ProcessA a (e, b) o -> ProcessA a e o
withRecent :: (ArrowApply a, Occasional o) => ProcessA a (e, b) o -> ProcessA a (e, Event b) o
switch :: ArrowApply a => ProcessA a b (c, Event t) -> (t -> ProcessA a b c) -> ProcessA a b c
dSwitch :: ArrowApply a => ProcessA a b (c, Event t) -> (t -> ProcessA a b c) -> ProcessA a b c
rSwitch :: ArrowApply a => ProcessA a b c -> ProcessA a (b, Event (ProcessA a b c)) c
drSwitch :: ArrowApply a => ProcessA a b c -> ProcessA a (b, Event (ProcessA a b c)) c
kSwitch :: ArrowApply a => ProcessA a b c -> ProcessA a (b, c) (Event t) -> (ProcessA a b c -> t -> ProcessA a b c) -> ProcessA a b c
dkSwitch :: ArrowApply a => ProcessA a b c -> ProcessA a (b, c) (Event t) -> (ProcessA a b c -> t -> ProcessA a b c) -> ProcessA a b c
pSwitch :: (ArrowApply a, Traversable col) => (forall sf. b -> col sf -> col (ext, sf)) -> col (ProcessA a ext c) -> ProcessA a (b, col c) (Event mng) -> (col (ProcessA a ext c) -> mng -> ProcessA a b (col c)) -> ProcessA a b (col c)
pSwitchB :: (ArrowApply a, Traversable col) => col (ProcessA a b c) -> ProcessA a (b, col c) (Event mng) -> (col (ProcessA a b c) -> mng -> ProcessA a b (col c)) -> ProcessA a b (col c)
rpSwitch :: (ArrowApply a, Traversable col) => (forall sf. b -> col sf -> col (ext, sf)) -> col (ProcessA a ext c) -> ProcessA a (b, Event (col (ProcessA a ext c) -> col (ProcessA a ext c))) (col c)
rpSwitchB :: (ArrowApply a, Traversable col) => col (ProcessA a b c) -> ProcessA a (b, Event (col (ProcessA a b c) -> col (ProcessA a b c))) (col c)
tee :: ArrowApply a => ProcessA a (Event b1, Event b2) (Event (Either b1 b2))
gather :: (ArrowApply a, Foldable f) => ProcessA a (f (Event b)) (Event b)
-- | It's also possible that source is defined without any await.
--
-- But awaits are useful to synchronize other inputs.
source :: ArrowApply a => [c] -> ProcessA a (Event b) (Event c)
fork :: (ArrowApply a, Foldable f) => ProcessA a (Event (f b)) (Event b)
filter :: ArrowApply a => a o Bool -> ProcessA a (Event o) (Event o)
echo :: ArrowApply a => ProcessA a (Event b) (Event b)
anytime :: ArrowApply a => a b c -> ProcessA a (Event b) (Event c)
par :: (ArrowApply a, Traversable col) => (forall sf. b -> col sf -> col (ext, sf)) -> col (ProcessA a ext c) -> ProcessA a b (col c)
parB :: (ArrowApply a, Traversable col) => col (ProcessA a b c) -> ProcessA a b (col c)
module Control.Arrow.Machine.Running
run :: ArrowApply a => ProcessA a (Event b) (Event c) -> a [b] [c]
-- | Represents return values and informations of step executions.
data ExecInfo fa
ExecInfo :: fa -> Bool -> Bool -> ExecInfo fa
yields :: ExecInfo fa -> fa
hasConsumed :: ExecInfo fa -> Bool
hasStopped :: ExecInfo fa -> Bool
stepRun :: ArrowApply a => ProcessA a (Event b) (Event c) -> a b (ExecInfo [c], ProcessA a (Event b) (Event c))
stepYield :: ArrowApply a => ProcessA a (Event b) (Event c) -> a b (ExecInfo (Maybe c), ProcessA a (Event b) (Event c))
instance Eq fa => Eq (ExecInfo fa)
instance Show fa => Show (ExecInfo fa)
instance Alternative f => Monoid (ExecInfo (f a))
module Control.Arrow.Machine
-- | The stream transducer arrow.
--
-- To construct ProcessA instances, use Plan, arr,
-- functions declared in Utils, or arrow combinations of them.
data ProcessA a b c
fit :: (Arrow a, Arrow a') => (forall p q. a p q -> a' p q) -> ProcessA a b c -> ProcessA a' b c