cek-dhall
Copyright(c) Nadia Yvette Chambers 2026
LicenseEUPL-1.2
MaintainerNadia Chambers <nadia.yvette.chambers@ik.me>
Stabilityexperimental
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cek.Dhall

Description

Implements a tailored Felleisen-Friedman CEK machine for the normalization and evaluation of Dhall language constructs (natural numbers, integers, booleans, text, records, projections, lists, and closures).

Architectural Context

Per Note [Felleisen-Friedman CEK Abstract Machine] [ref:note-core-architecture], this module models Dhall strong normalization through tail-recursive transition steps: * Record fields are evaluated inside-out. * Projections (DField) resolve against fully evaluated record values. * Operators (DOpPlus, DOpTextAppend) evaluate operands strictly before combining.

Synopsis

Dhall AST

data DhallExpr Source #

Abstract syntax for normalized Dhall expressions.

Constructors

DVar !Text

Variable identifier

DLam !Text !DhallExpr

Lambda abstraction (\(\lambda x. e\))

DApp !DhallExpr !DhallExpr

Function application

DLet !Text !DhallExpr !DhallExpr

Let-binding (let x = e1 in e2)

DNat !Word64

Natural literal (+42)

DInt !Integer

Signed integer literal (-7)

DBool !Bool

Boolean literal (True, False)

DText !Text

Text literal ("hello")

DRecord ![(Text, DhallExpr)]

Record literal ({ x = 1, y = 2 })

DField !DhallExpr !Text

Field selection (r.x)

DList ![DhallExpr]

List literal ([1, 2, 3])

DOpPlus !DhallExpr !DhallExpr

Natural addition (n + m)

DOpTextAppend !DhallExpr !DhallExpr

Text concatenation (s1 ++ s2)

Instances

Instances details
Eq DhallExpr Source # 
Instance details

Defined in Cek.Dhall

Methods

(==) :: DhallExpr -> DhallExpr -> Bool

(/=) :: DhallExpr -> DhallExpr -> Bool

Generic DhallExpr Source # 
Instance details

Defined in Cek.Dhall

Associated Types

type Rep DhallExpr 
Instance details

Defined in Cek.Dhall

type Rep DhallExpr = D1 ('MetaData "DhallExpr" "Cek.Dhall" "cek-dhall-0.1.0.0-inplace" 'False) (((C1 ('MetaCons "DVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: (C1 ('MetaCons "DLam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr)) :+: C1 ('MetaCons "DApp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr)))) :+: (C1 ('MetaCons "DLet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr))) :+: (C1 ('MetaCons "DNat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :+: C1 ('MetaCons "DInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Integer))))) :+: ((C1 ('MetaCons "DBool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)) :+: (C1 ('MetaCons "DText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "DRecord" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [(Text, DhallExpr)])))) :+: ((C1 ('MetaCons "DField" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "DList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [DhallExpr]))) :+: (C1 ('MetaCons "DOpPlus" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr)) :+: C1 ('MetaCons "DOpTextAppend" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr))))))

Methods

from :: DhallExpr -> Rep DhallExpr x

to :: Rep DhallExpr x -> DhallExpr

Show DhallExpr Source # 
Instance details

Defined in Cek.Dhall

Methods

showsPrec :: Int -> DhallExpr -> ShowS

show :: DhallExpr -> String

showList :: [DhallExpr] -> ShowS

type Rep DhallExpr Source # 
Instance details

Defined in Cek.Dhall

type Rep DhallExpr = D1 ('MetaData "DhallExpr" "Cek.Dhall" "cek-dhall-0.1.0.0-inplace" 'False) (((C1 ('MetaCons "DVar" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: (C1 ('MetaCons "DLam" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr)) :+: C1 ('MetaCons "DApp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr)))) :+: (C1 ('MetaCons "DLet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr))) :+: (C1 ('MetaCons "DNat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :+: C1 ('MetaCons "DInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Integer))))) :+: ((C1 ('MetaCons "DBool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)) :+: (C1 ('MetaCons "DText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "DRecord" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [(Text, DhallExpr)])))) :+: ((C1 ('MetaCons "DField" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "DList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [DhallExpr]))) :+: (C1 ('MetaCons "DOpPlus" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr)) :+: C1 ('MetaCons "DOpTextAppend" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr))))))

Value Domain

data DhallVal Source #

Normalized Dhall values.

Constructors

VNat !Word64

Natural number value

VInt !Integer

Integer value

VBool !Bool

Boolean value

VText !Text

Text string value

VClosure !Text !DhallExpr !DhallEnv

Lexical closure \(\langle x, e, E \rangle\)

VRecord ![(Text, DhallVal)]

Fully evaluated record value

VList ![DhallVal]

Evaluated list value

Instances

Instances details
Eq DhallVal Source # 
Instance details

Defined in Cek.Dhall

Methods

(==) :: DhallVal -> DhallVal -> Bool

(/=) :: DhallVal -> DhallVal -> Bool

Generic DhallVal Source # 
Instance details

Defined in Cek.Dhall

Associated Types

type Rep DhallVal 
Instance details

Defined in Cek.Dhall

type Rep DhallVal = D1 ('MetaData "DhallVal" "Cek.Dhall" "cek-dhall-0.1.0.0-inplace" 'False) ((C1 ('MetaCons "VNat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :+: (C1 ('MetaCons "VInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Integer)) :+: C1 ('MetaCons "VBool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))) :+: ((C1 ('MetaCons "VText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "VClosure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv)))) :+: (C1 ('MetaCons "VRecord" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [(Text, DhallVal)])) :+: C1 ('MetaCons "VList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [DhallVal])))))

Methods

from :: DhallVal -> Rep DhallVal x

to :: Rep DhallVal x -> DhallVal

Show DhallVal Source # 
Instance details

Defined in Cek.Dhall

Methods

showsPrec :: Int -> DhallVal -> ShowS

show :: DhallVal -> String

showList :: [DhallVal] -> ShowS

type Rep DhallVal Source # 
Instance details

Defined in Cek.Dhall

type Rep DhallVal = D1 ('MetaData "DhallVal" "Cek.Dhall" "cek-dhall-0.1.0.0-inplace" 'False) ((C1 ('MetaCons "VNat" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64)) :+: (C1 ('MetaCons "VInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Integer)) :+: C1 ('MetaCons "VBool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))) :+: ((C1 ('MetaCons "VText" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "VClosure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv)))) :+: (C1 ('MetaCons "VRecord" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [(Text, DhallVal)])) :+: C1 ('MetaCons "VList" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [DhallVal])))))

newtype DhallEnv Source #

Lexical environment for Dhall evaluation.

Constructors

DhallEnv 

Fields

Instances

Instances details
Eq DhallEnv Source # 
Instance details

Defined in Cek.Dhall

Methods

(==) :: DhallEnv -> DhallEnv -> Bool

(/=) :: DhallEnv -> DhallEnv -> Bool

Generic DhallEnv Source # 
Instance details

Defined in Cek.Dhall

Associated Types

type Rep DhallEnv 
Instance details

Defined in Cek.Dhall

type Rep DhallEnv = D1 ('MetaData "DhallEnv" "Cek.Dhall" "cek-dhall-0.1.0.0-inplace" 'True) (C1 ('MetaCons "DhallEnv" 'PrefixI 'True) (S1 ('MetaSel ('Just "unDhallEnv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Text, DhallVal)])))

Methods

from :: DhallEnv -> Rep DhallEnv x

to :: Rep DhallEnv x -> DhallEnv

Show DhallEnv Source # 
Instance details

Defined in Cek.Dhall

Methods

showsPrec :: Int -> DhallEnv -> ShowS

show :: DhallEnv -> String

showList :: [DhallEnv] -> ShowS

type Rep DhallEnv Source # 
Instance details

Defined in Cek.Dhall

type Rep DhallEnv = D1 ('MetaData "DhallEnv" "Cek.Dhall" "cek-dhall-0.1.0.0-inplace" 'True) (C1 ('MetaCons "DhallEnv" 'PrefixI 'True) (S1 ('MetaSel ('Just "unDhallEnv") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Text, DhallVal)])))

emptyDhallEnv :: DhallEnv Source #

Construct an empty Dhall environment.

extendDhallEnv :: Text -> DhallVal -> DhallEnv -> DhallEnv Source #

Extend a Dhall environment with a variable binding.

lookupDhallEnv :: Text -> DhallEnv -> Maybe DhallVal Source #

Lookup a variable in a Dhall environment.

Continuation Frames

data DhallFrame Source #

Continuation frames for Dhall evaluation contexts.

Constructors

DFrameArg !DhallExpr !DhallEnv

Waiting for function argument

DFrameFun !DhallVal

Waiting for function body to apply

DFrameLet !Text !DhallExpr !DhallEnv

Waiting for let-bound definition

DFrameField !Text

Waiting for record expression to project field

DFrameOpPlusR !DhallExpr !DhallEnv

Waiting for right operand of addition

DFrameOpPlusL !Word64

Waiting to add left natural

DFrameOpTextR !DhallExpr !DhallEnv

Waiting for right operand of text append

DFrameOpTextL !Text

Waiting to append left text

Instances

Instances details
Eq DhallFrame Source # 
Instance details

Defined in Cek.Dhall

Methods

(==) :: DhallFrame -> DhallFrame -> Bool

(/=) :: DhallFrame -> DhallFrame -> Bool

Generic DhallFrame Source # 
Instance details

Defined in Cek.Dhall

Associated Types

type Rep DhallFrame 
Instance details

Defined in Cek.Dhall

type Rep DhallFrame = D1 ('MetaData "DhallFrame" "Cek.Dhall" "cek-dhall-0.1.0.0-inplace" 'False) (((C1 ('MetaCons "DFrameArg" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv)) :+: C1 ('MetaCons "DFrameFun" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallVal))) :+: (C1 ('MetaCons "DFrameLet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv))) :+: C1 ('MetaCons "DFrameField" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)))) :+: ((C1 ('MetaCons "DFrameOpPlusR" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv)) :+: C1 ('MetaCons "DFrameOpPlusL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) :+: (C1 ('MetaCons "DFrameOpTextR" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv)) :+: C1 ('MetaCons "DFrameOpTextL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)))))

Methods

from :: DhallFrame -> Rep DhallFrame x

to :: Rep DhallFrame x -> DhallFrame

Show DhallFrame Source # 
Instance details

Defined in Cek.Dhall

Methods

showsPrec :: Int -> DhallFrame -> ShowS

show :: DhallFrame -> String

showList :: [DhallFrame] -> ShowS

type Rep DhallFrame Source # 
Instance details

Defined in Cek.Dhall

type Rep DhallFrame = D1 ('MetaData "DhallFrame" "Cek.Dhall" "cek-dhall-0.1.0.0-inplace" 'False) (((C1 ('MetaCons "DFrameArg" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv)) :+: C1 ('MetaCons "DFrameFun" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallVal))) :+: (C1 ('MetaCons "DFrameLet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv))) :+: C1 ('MetaCons "DFrameField" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)))) :+: ((C1 ('MetaCons "DFrameOpPlusR" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv)) :+: C1 ('MetaCons "DFrameOpPlusL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word64))) :+: (C1 ('MetaCons "DFrameOpTextR" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv)) :+: C1 ('MetaCons "DFrameOpTextL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)))))

type DhallCont = [DhallFrame] Source #

Dhall continuation stack.

emptyDhallCont :: DhallCont Source #

Construct an empty Dhall continuation stack.

Machine State & Evaluator

data DhallState Source #

Active state of the Dhall CEK abstract machine.

Constructors

DStateEval !DhallExpr !DhallEnv !DhallCont

Control expression \(C\), environment \(E\), continuation \(K\)

DStateReturn !DhallVal !DhallCont

Value \(V\) being delivered to continuation \(K\)

Instances

Instances details
Eq DhallState Source # 
Instance details

Defined in Cek.Dhall

Methods

(==) :: DhallState -> DhallState -> Bool

(/=) :: DhallState -> DhallState -> Bool

Generic DhallState Source # 
Instance details

Defined in Cek.Dhall

Associated Types

type Rep DhallState 
Instance details

Defined in Cek.Dhall

type Rep DhallState = D1 ('MetaData "DhallState" "Cek.Dhall" "cek-dhall-0.1.0.0-inplace" 'False) (C1 ('MetaCons "DStateEval" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallCont))) :+: C1 ('MetaCons "DStateReturn" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallVal) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallCont)))

Methods

from :: DhallState -> Rep DhallState x

to :: Rep DhallState x -> DhallState

Show DhallState Source # 
Instance details

Defined in Cek.Dhall

Methods

showsPrec :: Int -> DhallState -> ShowS

show :: DhallState -> String

showList :: [DhallState] -> ShowS

type Rep DhallState Source # 
Instance details

Defined in Cek.Dhall

type Rep DhallState = D1 ('MetaData "DhallState" "Cek.Dhall" "cek-dhall-0.1.0.0-inplace" 'False) (C1 ('MetaCons "DStateEval" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallExpr) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallEnv) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallCont))) :+: C1 ('MetaCons "DStateReturn" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallVal) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 DhallCont)))

stepDhallCEK :: DhallState -> Either Text (Maybe DhallState) Source #

Advance the Dhall CEK machine by a single deterministic transition step.

evalDhallCEK :: DhallExpr -> Either Text DhallVal Source #

Evaluate a Dhall expression to its final normalized value under the empty environment.