Safe Haskell | None |
---|---|
Language | Haskell98 |
- data Set n :: [*] -> * where
- get :: Var v -> State '[v :-> (a :! R)] a
- put :: Var v -> a -> State '[v :-> (a :! W)] ()
- data State s a = State {}
- data k :-> v = (Var k) :-> v
- data a :! s = a :! (Action s)
- data Eff
- data Action s = Eff
- data Var k where
- union :: Unionable s t => Set s -> Set t -> Set (UnionS s t)
- type UnionS s t = Nub (Sort (s :++ t))
- type family Reads t where ...
- type family Writes t where ...
- type Unionable s t = (Sortable (s :++ t), Nubable (Sort (s :++ t)) (Nub (Sort (s :++ t))), Split s t (Union s t))
- class Sortable xs
- type SetLike s = Nub (Sort s)
- type StateSet f = (StateSetProperties f, StateSetProperties (Reads f), StateSetProperties (Writes f))
- type IntersectR s t = (Sortable (s :++ t), Update (Sort (s :++ t)) t)
- class Update s t
- type family Sort k (xs :: [k]) :: [k] where ...
- class Split s t st
Documentation
get :: Var v -> State '[v :-> (a :! R)] a Source #
Read from a variable v
of type a
. Raise a read effect.
put :: Var v -> a -> State '[v :-> (a :! W)] () Source #
Write to a variable v
with a value of type a
. Raises a write effect
Parametric effect state monad
data k :-> v infixl 2 Source #
(Show (Var k), Show v) => Show ((:->) k v) Source # | |
Update ((:) * ((:->) u ((:!) b s)) as) as' => Update ((:) * ((:->) v ((:!) a W)) ((:) * ((:->) u ((:!) b s)) as)) as' Source # | |
Update ((:) * ((:->) v ((:!) a R)) as) as' => Update ((:) * ((:->) v ((:!) a W)) ((:) * ((:->) v ((:!) b R)) as)) as' Source # | |
Update ((:) * ((:->) u ((:!) b s)) as) as' => Update ((:) * ((:->) v ((:!) a R)) ((:) * ((:->) u ((:!) b s)) as)) ((:) * ((:->) v ((:!) a R)) as') Source # | |
type Cmp * ((:->) v a) ((:->) u b) Source # | |
Describes an effect action s
on a value of type a
(Show (Action f), Show a) => Show ((:!) a f) Source # | |
Update ((:) * ((:->) u ((:!) b s)) as) as' => Update ((:) * ((:->) v ((:!) a W)) ((:) * ((:->) u ((:!) b s)) as)) as' Source # | |
Update ((:) * ((:->) v ((:!) a R)) as) as' => Update ((:) * ((:->) v ((:!) a W)) ((:) * ((:->) v ((:!) b R)) as)) as' Source # | |
Update ((:) * ((:->) u ((:!) b s)) as) as' => Update ((:) * ((:->) v ((:!) a R)) ((:) * ((:->) u ((:!) b s)) as)) ((:) * ((:->) v ((:!) a R)) as') Source # | |
Provides an effect-parameterised version of the state monad, which gives an effect system for stateful computations with annotations that are sets of variable-type-action triples.
Distinguish reads, writes, and read-writes
Provides a wrapper for effect actions
union :: Unionable s t => Set s -> Set t -> Set (UnionS s t) Source #
Union operation for state effects
type Unionable s t = (Sortable (s :++ t), Nubable (Sort (s :++ t)) (Nub (Sort (s :++ t))), Split s t (Union s t)) Source #
Value-level quick sort that respects the type-level ordering
type StateSet f = (StateSetProperties f, StateSetProperties (Reads f), StateSetProperties (Writes f)) Source #
Captures what it means to be a set of state effects
Update reads, that is any writes are pushed into reads, a bit like intersection
update
Update xs ([] *) Source # | |
Update ((:) * ((:->) u ((:!) b s)) as) as' => Update ((:) * ((:->) v ((:!) a W)) ((:) * ((:->) u ((:!) b s)) as)) as' Source # | |
Update ((:) * ((:->) v ((:!) a R)) as) as' => Update ((:) * ((:->) v ((:!) a W)) ((:) * ((:->) v ((:!) b R)) as)) as' Source # | |
Update ((:) * ((:->) u ((:!) b s)) as) as' => Update ((:) * ((:->) v ((:!) a R)) ((:) * ((:->) u ((:!) b s)) as)) ((:) * ((:->) v ((:!) a R)) as') Source # | |
Update ((:) * e ([] *)) ((:) * e ([] *)) Source # | |