shimmer-0.1.3.3: The Reflective Lambda Machine

Safe HaskellSafe
LanguageHaskell98

SMR.Core.Step

Synopsis

Documentation

data Config s p w Source #

Evaluation config

Constructors

Config 

Fields

data World w Source #

World state for evaluation

Constructors

World 

Fields

data Result Source #

Result of evaluation.

Constructors

ResultDone 
ResultError Text 
Instances
Show Result Source # 
Instance details

Defined in SMR.Core.Step

newWorld :: w -> IO (World w) Source #

Initialize a new 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.