ether-0.3.1.0: Monad transformers and classes

Safe HaskellNone
LanguageHaskell2010

Control.Ether.Abbr

Description

Abbreviations for constraints.

Synopsis

Documentation

data tag --> r Source

Denotes MonadReader. The mnemonic is that you read values of type r from the reader environment tagged by tag, thus the arrows points from tag to r.

Instances

type ReifyAbbr ((-->) tag r) m = MonadReader tag r m Source 

data tag <-- w Source

Denotes MonadWriter. The mnemonic is that you write values of type w to the writer accumulator tagged by tag, thus the arrows points from w to tag.

Instances

type ReifyAbbr ((<--) tag w) m = MonadWriter tag w m Source 

data tag <-> s Source

Denotes MonadState. The mnemonic is that you can both read from and write into the state, thus the arrow points in both directions.

Instances

type ReifyAbbr ((<->) tag s) m = MonadState tag s m Source 

data tag -!- e Source

Denotes MonadExcept.

Instances

type ReifyAbbr ((-!-) tag e) m = MonadExcept tag e m Source 

type family Ether abbrs m :: Constraint Source

Reify a list of constraint abbreviations.

f :: Ether '[Foo --> r, Bar <-- w, Baz <-> s, Quux -!- e] m => m a

expands into

f :: ( MonadReader Foo  r m
     , MonadWriter Bar  w m
     , MonadState  Baz  s m
     , MonadExcept Quux e m
     ) => m a

Equations

Ether `[]` m = () 
Ether (abbr : abbrs) m = (ReifyAbbr abbr m, Ether abbrs m) 

type family ReifyAbbr abbr m :: Constraint Source

Turns an abbreviation into an actual constraint.

Instances

type ReifyAbbr (E e) m = MonadExcept e m Source 
type ReifyAbbr (S s) m = MonadState s m Source 
type ReifyAbbr (W w) m = MonadWriter w m Source 
type ReifyAbbr (R r) m = MonadReader r m Source 
type ReifyAbbr ((-!-) tag e) m = MonadExcept tag e m Source 
type ReifyAbbr ((<->) tag s) m = MonadState tag s m Source 
type ReifyAbbr ((<--) tag w) m = MonadWriter tag w m Source 
type ReifyAbbr ((-->) tag r) m = MonadReader tag r m Source