Safe Haskell | Safe |
---|---|
Language | Haskell98 |
- data Config s p w = Config {
- configUnderLambdas :: !Bool
- configHeadArgs :: !Bool
- configPrims :: !(Map p (PrimEval s p w))
- configDeclsMac :: !(Map Name (Exp s p))
- data World w = World {
- worldNomGen :: !(IORef Integer)
- worldUser :: w
- data Result
- newWorld :: w -> IO (World w)
- steps :: (Ord p, Show p) => Config s p w -> World w -> Exp s p -> IO (Either Text (Exp s p))
- step :: (Ord p, Show p) => Config s p w -> World w -> Exp s p -> IO (Either Result (Exp s p))
Documentation
Evaluation config
Config | |
|
World state for evaluation
World | |
|
steps :: (Ord p, Show p) => Config s p w -> World w -> Exp s p -> IO (Either Text (Exp s p)) Source #
Multi-step reduction to normal form.
step :: (Ord p, Show p) => Config s p w -> World w -> Exp s p -> IO (Either Result (Exp s p)) Source #
Single step reduction.
This is a definitional interpreter, intended to be easy to understand and get right, but not fast. Each time we take a step we decend into the AST looking for the next redex, which causes evaluation to have a higher asymptotic complexity than it would with an evaluator that that manages the evaluation context properly.