Safe Haskell | Safe-Inferred |
---|
Compilation Monad and combinators for quickly assembling simple compilers.
Control/Compilation/Environment.hs
State extension class and combinators for implementations of a state that support an environment (i.e., lookup table or dictionary) data structure or structures.
- type Env a = [(String, a)]
- class StateExtension a => Environment a b where
- project :: a -> Env b
- inject :: Env b -> a -> a
- addEnv :: String -> b -> Compilation a ()
- popEnv :: Compilation a ()
- dropEnv :: Int -> Compilation a ()
- lookupEnv :: String -> Compilation a (Maybe b)
- setEnv :: Env b -> Compilation a ()
- getEnv :: Compilation a (Env b)
Documentation
class StateExtension a => Environment a b whereSource
State extension class definition.
inject :: Env b -> a -> aSource
addEnv :: String -> b -> Compilation a ()Source
popEnv :: Compilation a ()Source
dropEnv :: Int -> Compilation a ()Source
lookupEnv :: String -> Compilation a (Maybe b)Source
setEnv :: Env b -> Compilation a ()Source
getEnv :: Compilation a (Env b)Source