Enclojure is a Clojure-like scripting language for Elm apps. Enclojure is experimental software and subject to breaking API changes.
Common.Env io
An execution environment. Think of this as the current state of the interpreter.
init : Env io
Initialize a fresh Enclojure execution environment
Common.Exception
An Enclojure exception value.
evalPure : EvalOptions -> Env io -> String -> Result Exception ( Common.Value io, Env io )
Evaluates a given Enclojure program in a provided environment. Returns an error on exception, and a tuple of returned value and changed environment on successful execution. Throws if the program attempts any side effects. May cause an infinite loop if EvalOptions.maxOps is not specified.
Returned by eval
Done value
- program completed successfully and returned value
.Error exception
- program threw exception
.Continue step
- program reached its EvalOptions.maxOps
quota and can be resumed with continueEval (perhaps at the next animation frame).RunIO io toStep
- program returned a side effect io
and expects the caller to handle the side effect and call toStep
with the result.Located (Common.Step io)
Represents an unfinished computation that can be continued using continueEval
.
eval : EvalOptions -> Env io -> String -> ( EvalResult io, Env io )
Evaluates a given Enclojure program in a provided environment. Returns a tuple of the evaluation result and modified environment. May cause an infinite loop if EvalOptions.maxOps is not specified.
continueEval : EvalOptions -> Step io -> ( EvalResult io, Env io )
Continue evaluation from a previously returned step.
getStepEnv : Step io -> Env io
Get the execution environment of an eval step.
setStepEnv : Env io -> Step io -> Step io
Modify the execution environment of an eval step.
getStepValue : Step io -> Maybe (Common.Value io)
Get the value of an eval step unless the step returned a side effect.
Represents the type of a documentation entry.
Common.FnInfo
Basic function info: name
, doc
, and a list of signatures
.
documentation : Env io -> List ( Doc, FnInfo )
Returns a list of documentation entries for a given evaluation environment.