- eval :: Env -> LispVal -> LispVal -> IOThrowsError LispVal
- evalLisp :: Env -> LispVal -> IOThrowsError LispVal
- evalString :: Env -> String -> IO String
- evalAndPrint :: Env -> String -> IO ()
- primitiveBindings :: IO Env
Documentation
eval :: Env -> LispVal -> LispVal -> IOThrowsError LispValSource
Core eval function
Evaluate a scheme expression.
NOTE: This function does not include macro support and should not be called directly. Instead, use evalLisp
Implementation Notes:
Internally, this function is written in continuation passing style (CPS) to allow the Scheme language itself to support first-class continuations. That is, at any point in the evaluation, call/cc may be used to capture the current continuation. Thus this code must call into the next continuation point, eg:
eval ... (makeCPS ...)
Instead of calling eval directly from within the same function, eg:
eval ... eval ...
This can make the code harder to follow, however some coding conventions have been established to make the
code easier to follow. Whenever a single function has been broken into multiple ones for the purpose of CPS,
those additional functions are defined locally using 'where', and each has been given a cps
prefix.
evalLisp :: Env -> LispVal -> IOThrowsError LispValSource
Evaluate lisp code that has already been loaded into haskell
TODO: code example for this, via ghci and/or a custom program.
primitiveBindings :: IO EnvSource
Environment containing the primitive forms that are built into the Scheme language. Note that this only includes forms that are implemented in Haskell; derived forms implemented in Scheme (such as let, list, etc) are available in the standard library which must be pulled into the environment using (load).