Documentation ¶
Overview ¶
Package core contains the core Dhall language implementation.
If you have a Term, you can call TypeOf() to ensure it is well-typed and to get its type. A well-typed Term can be Eval()ed to return a Value. A Value represents a fully beta-normalized Dhall value. If you have a Value, you can use Quote() to express it as a Term.
Index ¶
- func AlphaEquivalent(v1 Value, v2 Value) bool
- func Quote(v Value) term.Term
- type BoolLit
- type Builtin
- type Callable
- type DoubleLit
- type EmptyList
- type GomegaMatcher
- type IntegerLit
- type ListOf
- type NaturalLit
- type NonEmptyList
- type NoneOf
- type OptionalOf
- type Pi
- type PlainTextLit
- type RecordLit
- type RecordType
- type Some
- type UnionType
- type Universe
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlphaEquivalent ¶
AlphaEquivalent reports if two Values are equal after alpha-normalization, as defined by the standard. Broadly, two values are alpha-equivalent if they are structurally identical, ignoring label names.
Types ¶
type Builtin ¶
type Builtin string
A Builtin is a Value representing one of Dhall's non-Callable builtin constants.
type Callable ¶
Callable is a function Value that can be called with one Value argument. Call() may return nil if normalization isn't possible (for example, `Natural/even x` does not normalize). ArgType() returns the declared type of Call()'s parameter.
var ( NaturalBuild Callable = naturalBuild{} NaturalEven Callable = naturalEven{} NaturalFold Callable = naturalFold{} NaturalIsZero Callable = naturalIsZero{} NaturalOdd Callable = naturalOdd{} NaturalShow Callable = naturalShow{} NaturalSubtract Callable = naturalSubtract{} NaturalToInteger Callable = naturalToInteger{} IntegerClamp Callable = integerClamp{} IntegerNegate Callable = integerNegate{} IntegerShow Callable = integerShow{} IntegerToDouble Callable = integerToDouble{} DoubleShow Callable = doubleShow{} Optional Callable = optional{} OptionalBuild Callable = optionalBuild{} OptionalFold Callable = optionalFold{} None Callable = none{} TextShow Callable = textShow{} List Callable = list{} ListBuild Callable = listBuild{} ListFold Callable = listFold{} ListLength Callable = listLength{} ListHead Callable = listHead{} ListLast Callable = listLast{} ListIndexed Callable = listIndexed{} ListReverse Callable = listReverse{} )
These are the builtin Callable Values.
type EmptyList ¶
type EmptyList struct{ Type Value }
An EmptyList is an empty list literal Value of the given type.
type GomegaMatcher ¶
type GomegaMatcher interface { Match(actual interface{}) (success bool, err error) FailureMessage(actual interface{}) (message string) NegatedFailureMessage(actual interface{}) (message string) }
GomegaMatcher is a copy of github.com/onsi/gomega/types.GomegaMatcher, to avoid a dependency on gomega for users who don't want it.
func BeAlphaEquivalentTo ¶
func BeAlphaEquivalentTo(expected interface{}) GomegaMatcher
BeAlphaEquivalentTo returns a Gomega matcher which checks that a Term or Value is equivalent to the expected Term or Value. If either the expected or actual is a Term, it is Eval()ed first; then the Values are compared with AlphaEquivalentVals().
type NonEmptyList ¶
type NonEmptyList []Value
A NonEmptyList is a non-empty list literal Value with the given contents.
type OptionalOf ¶
type OptionalOf struct{ Type Value }
OptionalOf is a Value representing `Optional a`
type Pi ¶
A Pi is a Value representing a Dhall Pi type. Domain is the type of the domain, and Codomain is a go function which returns the type of the codomain, given the value of the domain.
type PlainTextLit ¶
type PlainTextLit string
A PlainTextLit is a literal Value of type Text, containing no interpolations.
type RecordType ¶
A RecordType is a Value representing a Dhall record type.
type Some ¶
type Some struct{ Val Value }
Some represents a Value which is present in an Optional type.
type Value ¶
type Value interface {
// contains filtered or unexported methods
}
A Value is a Dhall value in beta-normal form. You can think of Values as the subset of Dhall which cannot be beta-reduced any further. Valid Values include 3, "foo" and λ(x : Natural) → x.
You create a Value by calling Eval() on a Term. You can convert a Value back to a Term with Quote().
func AlphaBetaEval ¶
AlphaBetaEval alpha-beta-normalizes Term to a Value.