Minor renaming

This commit is contained in:
Ozzie Gooen 2020-07-02 14:33:41 +01:00
parent 96df9ced85
commit 19e9eaee83

View File

@ -267,11 +267,11 @@ module TreeNode = {
};
module FloatFromDist = {
let evaluateFromSymbolic = (distToFloatOp: distToFloatOperation, s) => {
let symbolicToLeaf = (distToFloatOp: distToFloatOperation, s) => {
SymbolicDist.T.operate(distToFloatOp, s)
|> E.R.bind(_, v => Ok(`Leaf(`SymbolicDist(`Float(v)))));
};
let evaluateFromRenderedDist =
let renderedToLeaf =
(distToFloatOp: distToFloatOperation, rs: DistTypes.shape)
: result(treeNode, string) => {
Distributions.Shape.operate(distToFloatOp, rs)
@ -285,9 +285,8 @@ module TreeNode = {
)
: result(treeNode, string) => {
switch (t) {
| `Leaf(`SymbolicDist(s)) => evaluateFromSymbolic(distToFloatOp, s) // we want to evaluate the distToFloatOp on the symbolic dist
| `Leaf(`RenderedDist(rs)) =>
evaluateFromRenderedDist(distToFloatOp, rs)
| `Leaf(`SymbolicDist(s)) => symbolicToLeaf(distToFloatOp, s) // we want to evaluate the distToFloatOp on the symbolic dist
| `Leaf(`RenderedDist(rs)) => renderedToLeaf(distToFloatOp, rs)
| `Operation(op) =>
E.R.bind(
operationToLeaf(op),
@ -310,10 +309,7 @@ module TreeNode = {
Ok(`Leaf(`RenderedDist(SymbolicDist.T.toShape(sampleCount, d))))
| `Leaf(`RenderedDist(_)) as t => Ok(t) // already a rendered shape, we're done here
| `Operation(op) =>
E.R.bind(
operationToLeaf(op),
toLeaf(operationToLeaf, sampleCount),
)
E.R.bind(operationToLeaf(op), toLeaf(operationToLeaf, sampleCount))
};
};
};
@ -355,11 +351,7 @@ module TreeNode = {
FloatFromDist.toLeaf(operationToLeaf(sampleCount), distToFloatOp, t)
| `Normalize(t) => Normalize.toLeaf(operationToLeaf(sampleCount), t)
| `Render(t) =>
Render.toLeaf(
operationToLeaf(sampleCount),
sampleCount,
t,
)
Render.toLeaf(operationToLeaf(sampleCount), sampleCount, t)
};
};