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

Safe HaskellNone
LanguageHaskell98

Control.Effect.Reader

Synopsis

Documentation

data Reader s a Source

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

Constructors

IxR 

Fields

runReader :: Set s -> a
 

Instances

Effect [*] Reader 
Subset s t => Subeffect [*] Reader s t

If s is a subset of t then, s is a subeffect of t

type Unit [*] Reader = [] * 
type Plus [*] Reader f g = Union * f g 
type Inv [*] Reader f g = (IsSet * f, IsSet * g, Split f g (Union * f g)) 

ask :: Var v -> Reader `[v :-> a]` a Source

ask for a variable v of type a, raising an effect

merge :: Unionable s t => (a -> Reader (Union s t) b) -> Reader s (a -> Reader t b) Source

Provides a way to emulated the ImplicitParams features of GHC/Haskell

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

Constructors

(Var k) :-> v 

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 

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") 

class Subset s t

Minimal complete definition

subset

Instances

Subset ([] *) ([] *) 
Subset ([] *) ((:) * x t) 
Subset s t => Subset ((:) * x s) ((:) * x t) 

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 ([] *))