Copyright | (C) 2017 Google Inc. |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Call-by-need evaluator based on the evaluator described in:
Maximilian Bolingbroke, Simon Peyton Jones, "Supercompilation by evaluation", Haskell '10, Baltimore, Maryland, USA.
Synopsis
- isUndefinedPrimVal :: Value -> Bool
- whnf' :: PrimStep -> PrimUnwind -> BindingMap -> TyConMap -> PrimHeap -> Supply -> InScopeSet -> Bool -> Term -> (PrimHeap, PureHeap, Term)
- whnf :: TyConMap -> Bool -> Machine -> Machine
- unwindStack :: Machine -> Maybe Machine
- type Step = Machine -> TyConMap -> Maybe Machine
- 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
- stepLetRec :: [LetBinding] -> Term -> Step
- stepCase :: Term -> Type -> [Alt] -> Step
- stepCast :: Term -> Type -> Type -> Step
- stepTick :: TickInfo -> Term -> Step
- step :: Step
- newBinder :: [Either TyVar Type] -> Term -> Step
- newLetBinding :: TyConMap -> Machine -> Term -> (Machine, Id)
- unwind :: TyConMap -> Machine -> Value -> Maybe Machine
- 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
isUndefinedPrimVal :: Value -> Bool Source #
whnf' :: PrimStep -> PrimUnwind -> BindingMap -> TyConMap -> PrimHeap -> Supply -> InScopeSet -> Bool -> Term -> (PrimHeap, PureHeap, Term) Source #
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.
stepLiteral :: Literal -> Step Source #
stepLetRec :: [LetBinding] -> Term -> Step Source #
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.
update :: IdScope -> Id -> Value -> Machine -> Machine Source #
Update the Heap with the evaluated term