Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type Program = Program NamedDeBruijn DefaultUni DefaultFun ()
- type Term = Term NamedDeBruijn DefaultUni DefaultFun ()
- toAnonDeBruijnTerm ∷ Term → Term DeBruijn DefaultUni DefaultFun ()
- toAnonDeBruijnProg ∷ Program NamedDeBruijn DefaultUni DefaultFun () → Program DeBruijn DefaultUni DefaultFun ()
- toNamedDeBruijnTerm ∷ Term DeBruijn DefaultUni DefaultFun () → Term NamedDeBruijn DefaultUni DefaultFun ()
- compiledCodeToTerm ∷ CompiledCodeIn DefaultUni DefaultFun a → Term
- haskellValueToTerm ∷ Lift DefaultUni a ⇒ a → Term
- unsafeRunTermCek ∷ Term → EvaluationResult Term
- runTermCek ∷ Term → (Either (CekEvaluationException NamedDeBruijn DefaultUni DefaultFun) Term, [Text])
- cekResultMatchesHaskellValue ∷ Lift DefaultUni a ⇒ Term → (EvaluationResult Term → EvaluationResult Term → b) → a → b
Documentation
type Program = Program NamedDeBruijn DefaultUni DefaultFun () Source #
type Term = Term NamedDeBruijn DefaultUni DefaultFun () Source #
toAnonDeBruijnTerm ∷ Term → Term DeBruijn DefaultUni DefaultFun () Source #
Remove the textual names from a NamedDeBruijn term
toAnonDeBruijnProg ∷ Program NamedDeBruijn DefaultUni DefaultFun () → Program DeBruijn DefaultUni DefaultFun () Source #
toNamedDeBruijnTerm ∷ Term DeBruijn DefaultUni DefaultFun () → Term NamedDeBruijn DefaultUni DefaultFun () Source #
Given a DeBruijn-named term, give every variable the name "v". If we later call unDeBruijn, that will rename the variables to things like "v123", where 123 is the relevant de Bruijn index.
compiledCodeToTerm ∷ CompiledCodeIn DefaultUni DefaultFun a → Term Source #
Just extract the body of a program wrapped in a CompiledCodeIn
. We use this a lot.
haskellValueToTerm ∷ Lift DefaultUni a ⇒ a → Term Source #
Lift a Haskell value to a PLC term. The constraints get a bit out of control if we try to do this over an arbitrary universe.
unsafeRunTermCek ∷ Term → EvaluationResult Term Source #
Just run a term to obtain an EvaluationResult
(used for tests etc.)
runTermCek ∷ Term → (Either (CekEvaluationException NamedDeBruijn DefaultUni DefaultFun) Term, [Text]) Source #
Just run a term.
cekResultMatchesHaskellValue ∷ Lift DefaultUni a ⇒ Term → (EvaluationResult Term → EvaluationResult Term → b) → a → b Source #
Evaluate a PLC term and check that the result matches a given Haskell value (perhaps obtained by running the Haskell code that the term was compiled from). We evaluate the lifted Haskell value as well, because lifting may produce reducible terms. The function is polymorphic in the comparison operator so that we can use it with both HUnit Assertions and QuickCheck Properties.