finos/morphir-elm/12.0.0

NOTE: the latest version is 22.0.2

Formerly Morgan-Stanley/morphir-elm. Search finds this package by either name.

Morphir.Value.Interpreter

This module contains an interpreter for Morphir expressions. The interpreter takes a piece of logic as input, evaluates it and returns the resulting data. In Morphir both logic and data is captured as a Value so the interpreter takes a Value and returns a Value (or an error for invalid expressions):

evaluate : Dict FQName Reference -> Value () () -> Result Error (Value () ())

Evaluates a value expression and returns another value expression or an error. You can also pass in other values by fully-qualified name that will be used for lookup if the expression contains references.

evaluate
    SDK.nativeFunctions
    (Value.Apply ()
        (Value.Reference () (fqn "Morphir.SDK" "Basics" "not"))
        (Value.Literal () (BoolLiteral True))
    )
    -- (Value.Literal () (BoolLiteral False))
Dict FQName Reference
-> Variables
-> List (Value () ())
-> Value () ()
-> Result Error (Value () ())

Evaluates a value expression recursively in a single pass while keeping track of variables and arguments along the evaluation.

Translate a distribution into references that can be fed into the interpreter to be used during evaluation.

Utilities

= NativeReference Function
| ValueReference (Value () ())

Reference to an other value. The other value can either be another Morphir Value or a native function.