Portability | Rank-N Types, MPTCs |
---|---|
Stability | provisional |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | Safe-Inferred |
Data.Machine.Plan
Contents
Description
- type Plan k o a = forall m. PlanT k o m a
- runPlan :: PlanT k o Identity a -> (a -> r) -> (o -> r -> r) -> (forall z. (z -> r) -> k z -> r -> r) -> r -> r
- newtype PlanT k o m a = PlanT {
- runPlanT :: forall r. (a -> m r) -> (o -> m r -> m r) -> (forall z. (z -> m r) -> k z -> m r -> m r) -> m r -> m r
- yield :: o -> Plan k o ()
- await :: Category k => Plan (k i) o i
- stop :: Plan k o a
- awaits :: k i -> Plan k o i
Plans
type Plan k o a = forall m. PlanT k o m aSource
A
is a specification for a pure Plan
k o aMachine
, that reads inputs selected by k
with types based on i
, writes values of type o
, and has intermediate results of type a
.
A
can be used as a PlanT
k o a
for any PlanT
k o m a
.
Monad
m
It is perhaps easier to think of Plan
in its un-cps'ed form, which would
look like:
data Plan
k o a
= Done a
| Yield o (Plan k o a)
| forall z. Await (z -> Plan k o a) (k z) (Plan k o a)
| Fail
runPlan :: PlanT k o Identity a -> (a -> r) -> (o -> r -> r) -> (forall z. (z -> r) -> k z -> r -> r) -> r -> rSource
Constructors
PlanT | |
Fields
|
Instances
MonadError e m => MonadError e (PlanT k o m) | |
MonadReader e m => MonadReader e (PlanT k o m) | |
MonadState s m => MonadState s (PlanT k o m) | |
MonadWriter w m => MonadWriter w (PlanT k o m) | |
MonadTrans (PlanT k o) | |
Monad (PlanT k o m) | |
Functor (PlanT k o m) | |
MonadPlus (PlanT k o m) | |
Applicative (PlanT k o m) | |
Alternative (PlanT k o m) | |
MonadIO m => MonadIO (PlanT k o m) |