symantic-base-0.2.0.20210731: Commonly useful symantics for Embedded Domain-Specific Languages (EDSL)
Safe HaskellNone
LanguageHaskell2010

Symantic.Reify

Description

Reify an Haskell value using type-directed normalisation-by-evaluation (NBE).

Synopsis

Documentation

data ReifyReflect repr meta a Source #

ReifyReflect witnesses the duality between meta and (repr a). It indicates which type variables in a are not to be instantiated with the arrow type, and instantiates them to (repr _) in meta. This is directly taken from: http://okmij.org/ftp/tagless-final/course/TDPE.hs

Constructors

ReifyReflect 

Fields

  • reify :: meta -> repr a

    reflect converts from a *represented* Haskell term of type a to an object *representing* that value of type a.

  • reflect :: repr a -> meta

    reflect converts back an object *representing* a value of type a, to the *represented* Haskell term of type a.

base :: ReifyReflect repr (repr a) a Source #

The base of induction : placeholder for a type which is not the arrow type.

(-->) :: Abstractable repr => ReifyReflect repr m1 o1 -> ReifyReflect repr m2 o2 -> ReifyReflect repr (m1 -> m2) (o1 -> o2) infixr 8 Source #

The inductive case : the arrow type. reify and reflect are built together inductively.

Using TemplateHaskell to fully auto-generate ReifyReflect

reifyTH :: Name -> Q Exp Source #

$(reifyTH 'Foo.bar) calls reify on bar with an ReifyReflect generated from the infered type of bar.