extensible-0.4.9: Extensible, efficient, optics-friendly data types and effects

Copyright(c) Fumiaki Kinoshita 2018
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Safe HaskellTrustworthy






mkField :: String -> DecsQ Source #

Generate fields using itemAssoc. mkField "foo Bar" defines:

foo :: FieldOptic "foo"
foo = itemAssoc (Proxy :: Proxy "foo")
_Bar :: FieldOptic Bar
_Bar = itemAssoc (Proxy :: Proxy Bar)

mkFieldAs :: Name -> String -> DecsQ Source #

mkFieldAs (mkName "foo") "bar" defines a field for "bar" as foo.

decEffects :: DecsQ -> DecsQ Source #

Generate named effects from a GADT declaration.

decEffects [d|
 data Blah a b x where
   Blah :: Int -> a -> Blah a b b


type Blah a b = "Blah" >: Action '[Int, a] b
blah :: forall xs a b
  . Associate "Blah" (Action '[Int, a] b) xs
  => Int -> a -> Eff xs b
blah a0 a1
  = liftEff
    (Data.Proxy.Proxy :: Data.Proxy.Proxy "Blah")
    (AArgument a0 (AArgument a1 AResult))

decEffectSet :: DecsQ -> DecsQ Source #

Instead of making a type synonym for individual actions, it defines a list of actions.

decEffectSuite :: DecsQ -> DecsQ Source #

Generates type synonyms for the set of actions and also individual actions.

customDecEffects Source #


:: Bool

generate a synonym of the set of actions

-> Bool

generate synonyms for individual actions

-> DecsQ 
-> DecsQ 

Generate effect suite with custom settings.