clash-ghc-1.8.1: Clash: a functional hardware description language - GHC frontend

Copyright | (C) 2017-2022 Google Inc. 2021-2022 QBayLogic B.V.
License | BSD2 (see the file LICENSE)
Maintainer | QBayLogic B.V. <devops@qbaylogic.com>
Safe Haskell | Safe-Inferred
Language | Haskell2010

Clash.GHC.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

- evaluator :: Evaluator
- stepVar :: Id -> Step
- stepData :: DataCon -> Step
- stepLiteral :: Literal -> Step
- stepPrim :: PrimInfo -> Step
- stepLam :: Id -> Term -> Step
- stepTyLam :: TyVar -> Term -> Step
- stepApp :: Term -> Term -> Step
- stepTyApp :: Term -> Type -> Step
- stepLet :: Bind Term -> Term -> Step
- stepCase :: Term -> Type -> [Alt] -> Step
- stepCast :: Term -> Type -> Type -> Step
- stepTick :: TickInfo -> Term -> Step
- ghcStep :: Step
- newBinder :: [Either TyVar Type] -> Term -> Step
- newLetBinding :: TyConMap -> Machine -> Term -> (Machine, Id)
- ghcUnwind :: Unwind
- update :: IdScope -> Id -> Value -> Machine -> Machine
- apply :: TyConMap -> Value -> Id -> Machine -> Machine
- instantiate :: TyConMap -> Value -> Type -> Machine -> Machine
- scrutinise :: Value -> Type -> [Alt] -> Machine -> Machine
- substInAlt :: DataCon -> [TyVar] -> [Id] -> [Either Term Type] -> Term -> Term
- allocate :: [LetBinding] -> Term -> Machine -> Machine
- letSubst :: PureHeap -> Supply -> Id -> (Supply, (Id, (Id, Term)))

# Documentation

evaluator :: Evaluator Source #

stepVar :: Id -> Step Source #

stepData :: DataCon -> Step Source #

stepLiteral :: Literal -> Step Source #

stepPrim :: PrimInfo -> Step Source #

stepLam :: Id -> Term -> Step Source #

stepTyLam :: TyVar -> Term -> Step Source #

stepApp :: Term -> Term -> Step Source #

stepTyApp :: Term -> Type -> Step Source #

stepLet :: Bind Term -> Term -> Step Source #

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

stepCast :: Term -> Type -> Type -> Step Source #

stepTick :: TickInfo -> Term -> Step Source #

ghcStep :: 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.

newLetBinding :: TyConMap -> Machine -> Term -> (Machine, Id) Source #

ghcUnwind :: Unwind 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

substInAlt :: DataCon -> [TyVar] -> [Id] -> [Either Term Type] -> Term -> Term Source #

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