Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module defines tools for associating PLC terms with their corresponding Haskell values.
Synopsis
- type KnownType val a = (KnownTypeAst TyName (UniOf val) a, MakeKnown val a)
- data Denotation term object res = ∀ args.Denotation {
- _denotationObject ∷ object
- _denotationToTerm ∷ object → term
- _denotationItself ∷ FoldArgs args res
- _denotationScheme ∷ TypeScheme term args res
- data DenotationContextMember term res = ∀ object. DenotationContextMember (Denotation term object res)
- newtype DenotationContext term = DenotationContext {
- unDenotationContext ∷ DMap TypeRep (Compose List (DenotationContextMember term))
- lookupInContext ∷ ∀ a term. TypeRep a → DenotationContext term → [DenotationContextMember term a]
- denoteVariable ∷ KnownType (Term TyName Name uni fun ()) res ⇒ Name → TypeRep res → res → Denotation (Term TyName Name uni fun ()) Name res
- insertVariable ∷ KnownType (Term TyName Name uni fun ()) a ⇒ Name → TypeRep a → a → DenotationContext (Term TyName Name uni fun ()) → DenotationContext (Term TyName Name uni fun ())
- insertBuiltin ∷ DefaultFun → DenotationContext (Term TyName Name DefaultUni DefaultFun ()) → DenotationContext (Term TyName Name DefaultUni DefaultFun ())
- typedBuiltins ∷ DenotationContext (Term TyName Name DefaultUni DefaultFun ())
Documentation
data Denotation term object res Source #
Haskell denotation of a PLC object. An object can be a Builtin
or a variable for example.
∀ args. Denotation | |
|
data DenotationContextMember term res Source #
A member of a DenotationContext
.
object
is existentially quantified, so the only thing that can be done with it,
is turning it into a Term
using _denotationToTerm
.
∀ object. DenotationContextMember (Denotation term object res) |
newtype DenotationContext term Source #
A context of DenotationContextMember
s.
Each row is a mapping from a type to a list of things that can return that type.
For example it can contain a mapping from integer
to
1. a bound variable of type integer
2. a bound variable of functional type with the result being integer
3. the AddInteger
Builtin
or any other Builtin
which returns an integer
.
lookupInContext ∷ ∀ a term. TypeRep a → DenotationContext term → [DenotationContextMember term a] Source #
Look up a list of Denotation
s from DenotationContext
each of which has a type that ends in
the same type as the one that the TypeRep
argument represents.
denoteVariable ∷ KnownType (Term TyName Name uni fun ()) res ⇒ Name → TypeRep res → res → Denotation (Term TyName Name uni fun ()) Name res Source #
Get the Denotation
of a variable.
insertVariable ∷ KnownType (Term TyName Name uni fun ()) a ⇒ Name → TypeRep a → a → DenotationContext (Term TyName Name uni fun ()) → DenotationContext (Term TyName Name uni fun ()) Source #
Insert a variable into a DenotationContext
.
insertBuiltin ∷ DefaultFun → DenotationContext (Term TyName Name DefaultUni DefaultFun ()) → DenotationContext (Term TyName Name DefaultUni DefaultFun ()) Source #
Insert a builtin into a DenotationContext
.
typedBuiltins ∷ DenotationContext (Term TyName Name DefaultUni DefaultFun ()) Source #
A DenotationContext
that consists of DefaultFun
s.
DEPRECATED: No need to update for a new builtin. Outdated, since we moved to quickcheck generators.