effect-monad-0.6.1: Embeds effect systems into Haskell using parameteric effect monads

Safe HaskellNone
LanguageHaskell98

Control.Effect.Writer

Synopsis

Documentation

data Writer w a Source

Provides an effect-parameterised version of the writer monad. Effects are sets of variable-type pairs, providing an effect system for writer effects.

Constructors

Writer 

Fields

runWriter :: (a, Set w)
 

Instances

Effect [*] Writer 
Superset s t => Subeffect [*] Writer s t 
type Unit [*] Writer = [] * 
type Plus [*] Writer s t = Union * s t 
type Inv [*] Writer s t = (IsSet * s, IsSet * t, Unionable s t) 

data Symbol :: *

(Kind) This is the kind of type-level symbols.

Instances

type (==) Symbol a b = EqSymbol a b 

put :: Var v -> a -> Writer `[v :-> a]` () Source

Write to variable v with value of type a

data k :-> v :: Symbol -> * -> *

Instances

(Show (Var k), Show v) => Show ((:->) k v) 
(Monoid u, Nubable ((:) * ((:->) k u) s)) => Nubable ((:) * ((:->) k u) ((:) * ((:->) k u) s))

Define the operation for removing duplicates using mappend

Update ((:) * ((:->) u ((:!) b s)) as) as' => Update ((:) * ((:->) v ((:!) a W)) ((:) * ((:->) u ((:!) b s)) as)) as' 
Update ((:) * ((:->) v ((:!) a R)) as) as' => Update ((:) * ((:->) v ((:!) a W)) ((:) * ((:->) v ((:!) b R)) as)) as' 
Update ((:) * ((:->) u ((:!) b s)) as) as' => Update ((:) * ((:->) v ((:!) a R)) ((:) * ((:->) u ((:!) b s)) as)) ((:) * ((:->) v ((:!) a R)) as') 
type Cmp * ((:->) v a) ((:->) u b) = CmpSymbol v u 

type IsSet s = (~) [k] s (Nub k (Sort k s))

data Set n :: [*] -> * where

Constructors

Empty :: Set ([] *) 
Ext :: e -> Set s -> Set ((:) * e s) 

Instances

(Show e, Show' (Set s)) => Show (Set ((:) * e s)) 
Show (Set ([] *)) 
(Show' (Set s), Show e) => Show' (Set ((:) * e s)) 
Show' (Set ([] *)) 

union :: Unionable s t => Set s -> Set t -> Set (Union * s t)

data Var k :: Symbol -> * where

Constructors

Var :: Var k 
X :: Var "x" 
Y :: Var "y" 
Z :: Var "z" 

Instances

Show (Var v) 
Show (Var "x") 
Show (Var "y") 
Show (Var "z") 

type Union s t = Nub k (Sort k (Append k s t))

type Unionable s t = (Sortable (Append * s t), Nubable (Sort * (Append * s t)))