Safe Haskell | None |
---|---|
Language | Haskell2010 |
Control.Arrow.Schedule
Description
Run scheduled computations in any (stateful) arrow, using an adapter.
This module mostly contains utilities for dealing with clock inputs. To get or
set the existing timeouts, use your RunSched
adapter on one of the functions
from Data.Schedule, which this module also re-exports.
Synopsis
- type RunSched t a = forall i o. ((i, Schedule t) -> (o, Schedule t)) -> a i o
- runTick :: (ArrowChoice a, Monoid o) => RunSched t a -> a (Tick, t) o -> a Tick o
- runTicksTo :: (ArrowChoice a, Monoid o) => RunSched t a -> a (Tick, t) o -> a Tick o
- getInput :: Arrow a => RunSched t a -> a TickDelta (Either Tick i) -> a i' (Either Tick i)
- mkOutput :: (ArrowChoice a, Monoid o) => RunSched t a -> a (Tick, t) o -> a i o -> a (Either Tick i) o
- tickTask :: (ArrowChoice a, ArrowApply a, Monoid o) => RunSched t a -> (forall f. Applicative f => (Tick -> f (Tick, t)) -> i -> f it) -> a it o -> a i o
- module Data.Schedule
Documentation
type RunSched t a = forall i o. ((i, Schedule t) -> (o, Schedule t)) -> a i o Source #
Something that can run Schedule
state transition arrows.
This could be pure (e.g. StateArrow
) or
impure (e.g. reference to a PrimST
).
runTicksTo :: (ArrowChoice a, Monoid o) => RunSched t a -> a (Tick, t) o -> a Tick o Source #
mkOutput :: (ArrowChoice a, Monoid o) => RunSched t a -> a (Tick, t) o -> a i o -> a (Either Tick i) o Source #
tickTask :: (ArrowChoice a, ArrowApply a, Monoid o) => RunSched t a -> (forall f. Applicative f => (Tick -> f (Tick, t)) -> i -> f it) -> a it o -> a i o Source #
A more general version of mkOutput
that uses a
Prism
-like optic.
Given an inner computation a it o
where one branch of the it
type has
a (
tuple representing individual input tasks, return an outer
computation of type Tick
, t)a i o
where the i
type only has a Tick
. When the
outer computation receives these Tick
inputs, it automatically resolves
the relevant tasks of type t
that are active for that Tick
, and passes
each tuple in sequence to the wrapped inner computation.
module Data.Schedule