clash-lib-1.2.1: CAES Language for Synchronous Hardware - As a Library

Copyright(C) 2017 Google Inc.
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Core.Evaluator

Description

Call-by-need evaluator based on the evaluator described in:

Maximilian Bolingbroke, Simon Peyton Jones, "Supercompilation by evaluation", Haskell '10, Baltimore, Maryland, USA.

Synopsis

Documentation

whnf :: TyConMap -> Bool -> Machine -> Machine Source #

Evaluate to WHNF given an existing Heap and Stack

unwindStack :: Machine -> Maybe Machine Source #

Completely unwind the stack to get back the complete term

type Step = Machine -> TyConMap -> Maybe Machine Source #

A single step in the partial evaluator. The result is the new heap and stack, and the next expression to be reduced.

stepCase :: Term -> Type -> [Alt] -> Step Source #

step :: Step Source #

Small-step operational semantics.

newBinder :: [Either TyVar Type] -> Term -> Step Source #

Take a list of types or type variables and create a lambda / type lambda for each one around the given term.

unwind :: TyConMap -> Machine -> Value -> Maybe Machine Source #

Unwind the stack by 1

update :: IdScope -> Id -> Value -> Machine -> Machine Source #

Update the Heap with the evaluated term

apply :: TyConMap -> Value -> Id -> Machine -> Machine Source #

Apply a value to a function

instantiate :: TyConMap -> Value -> Type -> Machine -> Machine Source #

Instantiate a type-abstraction

scrutinise :: Value -> Type -> [Alt] -> Machine -> Machine Source #

Evaluate a case-expression

allocate :: [LetBinding] -> Term -> Machine -> Machine Source #

Allocate let-bindings on the heap

letSubst :: PureHeap -> Supply -> Id -> (Supply, (Id, (Id, Term))) Source #

Create a unique name and substitution for a let-binder