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

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

Data.Extensible.TH

Description

 

Synopsis

Documentation

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)

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
 |]

generates

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 #

Arguments

:: Bool

generate a synonym of the set of actions

-> Bool

generate synonyms for individual actions

-> DecsQ 
-> DecsQ