Safe Haskell | None |
---|---|
Language | Haskell2010 |
Stg.Machine.Env
Description
Defines operations on local and global variable environments.
- addLocals :: [Mapping Var Value] -> Locals -> Locals
- makeLocals :: [Mapping Var Value] -> Locals
- val :: Locals -> Globals -> Atom -> Validate NotInScope Value
- vals :: Locals -> Globals -> [Atom] -> Validate NotInScope [Value]
- localVal :: Locals -> Atom -> Validate NotInScope Value
- newtype NotInScope = NotInScope [Var]
- globalVal :: Globals -> Atom -> Validate NotInScope Value
Locals
addLocals :: [Mapping Var Value] -> Locals -> Locals Source #
Add a list of bindings to the local environment.
Already existing variables will be shadowed (i.e. overwritten).
makeLocals :: [Mapping Var Value] -> Locals Source #
Create a local environment from a list of bindings.
val :: Locals -> Globals -> Atom -> Validate NotInScope Value Source #
Look up the value of an Atom
first in the local, then in the global
environment.
vals :: Locals -> Globals -> [Atom] -> Validate NotInScope [Value] Source #
Look up the values of many Atom
s, and return their values in the
input's order, or a list of variables not in scope.
localVal :: Locals -> Atom -> Validate NotInScope Value Source #
Look up the value of a variable in the local environment.
newtype NotInScope Source #
Type safety wrapper to report variables that were not in scope.
Constructors
NotInScope [Var] |