static-0.1.0.0: Type-safe and interoperable static values and closures

Safe HaskellNone
LanguageHaskell2010

Control.Static.TH

Synopsis

Documentation

staticRef :: Name -> Q Exp Source #

Refer to a static value, as a SKeyed.

Be sure to pass the argument to mkStaticTab so the referent exists.

staticKey :: Name -> Q Exp Source #

Get the symbol key of a static value, as a SKey.

Be sure to pass the argument to mkStaticTab so the referent exists.

Users typically don't need this; staticRef is more type-safe as it includes the type of the value, and this does not.

staticKeyType :: Name -> Q Type Source #

Get the symbol key type of a static value, as a type-level string.

mkStatics :: [Name] -> Q [Dec] Source #

Create top-level statically-keyed values from regular top-level values.

mkStaticsWithRefs :: ([Exp] -> Q [Dec]) -> Q [Dec] Source #

Create top-level statically-keyed values from regular top-level values, when their definitions need to refer to other statically-keyed values.

Since TH cannot handle references to names defined later in the source file, it is not possible to use mkStatics for this purpose; you must use this function instead, and then register the names later using mkStaticTab.

See unit tests for example usage.

mkDefStaticTab :: [Name] -> Q [Dec] Source #

Create a table holding the static values for a list of top-level names, binding it to the top-level name "staticTab".

mkStaticTab :: Name -> [Name] -> Q [Dec] Source #

Create a table holding the static values for a list of top-level names, binding it to the given top-level name.

newtype CxtW c a Source #

Data type wrapping a constraint, to avoid ImpredicativeTypes GHC error.

Constructors

CxtW 

Fields

Instances
PreClosure (CxtW c (e -> v -> r)) Source # 
Instance details

Defined in Control.Static.Closure

Associated Types

type Cxt (CxtW c (e -> v -> r)) :: Constraint Source #

type Env (CxtW c (e -> v -> r)) :: Type Source #

type Part (CxtW c (e -> v -> r)) :: Type Source #

Methods

applyPre :: CxtW c (e -> v -> r) -> Env (CxtW c (e -> v -> r)) -> Part (CxtW c (e -> v -> r)) Source #

type Cxt (CxtW c (e -> v -> r)) Source # 
Instance details

Defined in Control.Static.Closure

type Cxt (CxtW c (e -> v -> r)) = c
type Env (CxtW c (e -> v -> r)) Source # 
Instance details

Defined in Control.Static.Closure

type Env (CxtW c (e -> v -> r)) = e
type Part (CxtW c (e -> v -> r)) Source # 
Instance details

Defined in Control.Static.Closure

type Part (CxtW c (e -> v -> r)) = v -> r