diff --git a/src/distPlus/ProgramEvaluator.re b/src/distPlus/ProgramEvaluator.re index 21d18f63..2776743e 100644 --- a/src/distPlus/ProgramEvaluator.re +++ b/src/distPlus/ProgramEvaluator.re @@ -38,6 +38,15 @@ module Inputs = { }; }; +type export = [ + | `DistPlus(ProbExample.DistPlus.t) + | `Float(float) + | `Function( + (array(string), ProbExample.ExpressionTypes.ExpressionTree.node), + ProbExample.ExpressionTypes.ExpressionTree.environment, + ) +]; + module Internals = { let addVariable = ( @@ -122,12 +131,14 @@ let renderIfNeeded = | n => Ok(n) ); +// TODO: Consider using ExpressionTypes.ExpressionTree.getFloat or similar in this function let coersionToExportedTypes = ( inputs, env: ProbExample.ExpressionTypes.ExpressionTree.environment, node: ExpressionTypes.ExpressionTree.node, - ) => + ) + : result(export, string) => node |> renderIfNeeded(inputs) |> E.R.bind( diff --git a/src/distPlus/expressionTree/ExpressionTypes.re b/src/distPlus/expressionTree/ExpressionTypes.re index d63be0c2..6d34c255 100644 --- a/src/distPlus/expressionTree/ExpressionTypes.re +++ b/src/distPlus/expressionTree/ExpressionTypes.re @@ -124,7 +124,7 @@ module ExpressionTree = { type t = node; let render = (evaluationParams: evaluationParams, r) => - `Render(r) |> evaluateNode(evaluationParams) + `Render(r) |> evaluateNode(evaluationParams); let ensureIsRendered = (params, t) => switch (t) {