Eval package:clash-lib
The monad of partial evaluation. The inner monad is IO, as primitive
evaluation can attempt to evaluate IO actions.
An evaluator is a collection of basic building blocks which are used
to define partial evaluation. In this implementation, it consists of
two types of function:
- steps, which applies the reduction realtion to the current
term
- unwindings, which pop the stack and evaluate the stack frame
Variants of these functions also exist for evalauting primitive
operations. This is because there may be multiple frontends to the
compiler which can reuse a common step and unwind, but have different
primitives.
An evaluator for Clash core. This consists of two functions: one to
evaluate a term to weak-head normal form (WHNF) and another to
recursively evaluate sub-terms to obtain beta-normal eta-long form
(NF).
Render a blackbox given its context. Renders _just_ the blackbox, not
any corresponding includes, libraries, and so forth.
The main API of the partial evaluator. This exposes the main functions
needed to call the evaluator, and the type of evaluators. A concrete
implementation of an evaluator is required to use this module: this
can be imported from the library for the compiler front-end, e.g.
Clash.GHC.PartialEval in clash-ghc.
Evaluate an action in the partial evaluator, returning the result, and
the final state of the global environment.
Set the threshold for maximum unfolding depth in the evaluator. A
value of zero means no potentially non-terminating binding is
unfolded.
Command line flag: -fclash-evaluator-fuel-limit
Hardcoded evaluator for WHNF (old evaluator)
Hardcoded evaluator for partial evaluation