Formalized export type of ProgramEvaluator
This commit is contained in:
parent
9520175795
commit
e37d77d2de
|
@ -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 = {
|
module Internals = {
|
||||||
let addVariable =
|
let addVariable =
|
||||||
(
|
(
|
||||||
|
@ -122,12 +131,14 @@ let renderIfNeeded =
|
||||||
| n => Ok(n)
|
| n => Ok(n)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO: Consider using ExpressionTypes.ExpressionTree.getFloat or similar in this function
|
||||||
let coersionToExportedTypes =
|
let coersionToExportedTypes =
|
||||||
(
|
(
|
||||||
inputs,
|
inputs,
|
||||||
env: ProbExample.ExpressionTypes.ExpressionTree.environment,
|
env: ProbExample.ExpressionTypes.ExpressionTree.environment,
|
||||||
node: ExpressionTypes.ExpressionTree.node,
|
node: ExpressionTypes.ExpressionTree.node,
|
||||||
) =>
|
)
|
||||||
|
: result(export, string) =>
|
||||||
node
|
node
|
||||||
|> renderIfNeeded(inputs)
|
|> renderIfNeeded(inputs)
|
||||||
|> E.R.bind(
|
|> E.R.bind(
|
||||||
|
|
|
@ -124,7 +124,7 @@ module ExpressionTree = {
|
||||||
type t = node;
|
type t = node;
|
||||||
|
|
||||||
let render = (evaluationParams: evaluationParams, r) =>
|
let render = (evaluationParams: evaluationParams, r) =>
|
||||||
`Render(r) |> evaluateNode(evaluationParams)
|
`Render(r) |> evaluateNode(evaluationParams);
|
||||||
|
|
||||||
let ensureIsRendered = (params, t) =>
|
let ensureIsRendered = (params, t) =>
|
||||||
switch (t) {
|
switch (t) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user