Renaming of core lib and charts

This commit is contained in:
Ozzie Gooen 2020-02-23 13:27:52 +00:00
parent 6a57095cad
commit f844c9cc72
16 changed files with 123 additions and 195 deletions

View File

@ -1,15 +1,12 @@
open Jest; open Jest;
open Expect; open Expect;
let shape: DistributionTypes.xyShape = { let shape: DistTypes.xyShape = {xs: [|1., 4., 8.|], ys: [|8., 9., 2.|]};
xs: [|1., 4., 8.|],
ys: [|8., 9., 2.|],
};
let step: DistributionTypes.xyShape = { let step: DistTypes.xyShape = {
xs: [|1., 4., 8.|], xs: [|1., 4., 8.|],
ys: [|8., 17., 19.|], ys: [|8., 17., 19.|],
} /* }*/; } /* }*/ /* )*/;
// describe("Shape", () => // describe("Shape", () =>
// describe("XYShape", () => { // describe("XYShape", () => {
@ -18,4 +15,3 @@ let step: DistributionTypes.xyShape = {
// ); // );
// test("#yFOo", () => // test("#yFOo", () =>
// expect(Discrete.integrate(shape)) |> toEqual(step) // expect(Discrete.integrate(shape)) |> toEqual(step)
// );

View File

@ -1,59 +0,0 @@
[@bs.module "./cdfChartReact.js"]
external cdfChart: ReasonReact.reactClass = "default";
type primaryDistribution =
option({
.
"xs": array(float),
"ys": array(float),
});
type discrete =
option({
.
"xs": array(float),
"ys": array(float),
});
[@react.component]
let make =
(
~height=?,
~marginBottom=?,
~marginTop=?,
~maxX=?,
~minX=?,
~onHover=(f: float) => (),
~continuous=?,
~discrete=?,
~scale=?,
~showDistributionLines=?,
~showDistributionYAxis=?,
~showVerticalLine=?,
~timeScale=?,
~verticalLine=?,
~children=[||],
) =>
ReasonReact.wrapJsForReason(
~reactClass=cdfChart,
~props=
makeProps(
~height?,
~marginBottom?,
~marginTop?,
~maxX?,
~minX?,
~onHover,
~continuous?,
~discrete?,
~scale?,
~showDistributionLines?,
~showDistributionYAxis?,
~showVerticalLine?,
~timeScale?,
~verticalLine?,
(),
),
children,
)
|> ReasonReact.element;

View File

@ -1,24 +0,0 @@
module Styles = {
open Css;
let graph = chartColor =>
style([
selector(".axis", [fontSize(`px(9))]),
selector(".domain", [display(`none)]),
selector(".tick line", [display(`none)]),
selector(".tick text", [color(`hex("bfcad4"))]),
selector(".chart .area-path", [SVG.fill(chartColor)]),
]);
};
[@react.component]
let make = (~minX=None, ~maxX=None, ~height=50, ~color=`hex("7e9db7")) =>
<div className={Styles.graph(color)}>
<CdfChart__Base
height
?minX
?maxX
marginBottom=20
showVerticalLine=false
showDistributionLines=false
/>
</div>;

View File

@ -1,6 +1,6 @@
module DistPlusChart = { module DistPlusChart = {
[@react.component] [@react.component]
let make = (~distPlus: DistributionTypes.distPlus, ~onHover) => { let make = (~distPlus: DistTypes.distPlus, ~onHover) => {
open Distributions.DistPlus; open Distributions.DistPlus;
let discrete = distPlus |> T.toDiscrete; let discrete = distPlus |> T.toDiscrete;
let continuous = let continuous =
@ -9,8 +9,8 @@ module DistPlusChart = {
|> E.O.fmap(Distributions.Continuous.getShape); |> E.O.fmap(Distributions.Continuous.getShape);
let minX = T.minX(distPlus); let minX = T.minX(distPlus);
let maxX = T.maxX(distPlus); let maxX = T.maxX(distPlus);
let timeScale = distPlus.unit |> DistributionTypes.DistributionUnit.toJson; let timeScale = distPlus.unit |> DistTypes.DistributionUnit.toJson;
<CdfChart__Plain <DistributionChart
minX minX
maxX maxX
?discrete ?discrete
@ -24,7 +24,7 @@ module DistPlusChart = {
module IntegralChart = { module IntegralChart = {
[@react.component] [@react.component]
let make = (~distPlus: DistributionTypes.distPlus, ~onHover) => { let make = (~distPlus: DistTypes.distPlus, ~onHover) => {
open Distributions.DistPlus; open Distributions.DistPlus;
let integral = let integral =
Distributions.DistPlus.T.Integral.get(~cache=None, distPlus); Distributions.DistPlus.T.Integral.get(~cache=None, distPlus);
@ -35,8 +35,8 @@ module IntegralChart = {
|> E.O.fmap(Distributions.Continuous.getShape); |> E.O.fmap(Distributions.Continuous.getShape);
let minX = T.minX(integral); let minX = T.minX(integral);
let maxX = T.maxX(integral); let maxX = T.maxX(integral);
let timeScale = distPlus.unit |> DistributionTypes.DistributionUnit.toJson; let timeScale = distPlus.unit |> DistTypes.DistributionUnit.toJson;
<CdfChart__Plain <DistributionChart
minX minX
maxX maxX
?continuous ?continuous
@ -48,7 +48,7 @@ module IntegralChart = {
}; };
[@react.component] [@react.component]
let make = (~distPlus: DistributionTypes.distPlus) => { let make = (~distPlus: DistTypes.distPlus) => {
let (x, setX) = React.useState(() => 0.); let (x, setX) = React.useState(() => 0.);
let chart = let chart =
React.useMemo1( React.useMemo1(

View File

@ -1,3 +1,65 @@
module RawChart = {
[@bs.module "./cdfChartReact.js"]
external cdfChart: ReasonReact.reactClass = "default";
type primaryDistribution =
option({
.
"xs": array(float),
"ys": array(float),
});
type discrete =
option({
.
"xs": array(float),
"ys": array(float),
});
[@react.component]
let make =
(
~height=?,
~marginBottom=?,
~marginTop=?,
~maxX=?,
~minX=?,
~onHover=(f: float) => (),
~continuous=?,
~discrete=?,
~scale=?,
~showDistributionLines=?,
~showDistributionYAxis=?,
~showVerticalLine=?,
~timeScale=?,
~verticalLine=?,
~children=[||],
) =>
ReasonReact.wrapJsForReason(
~reactClass=cdfChart,
~props=
makeProps(
~height?,
~marginBottom?,
~marginTop?,
~maxX?,
~minX?,
~onHover,
~continuous?,
~discrete?,
~scale?,
~showDistributionLines?,
~showDistributionYAxis?,
~showVerticalLine?,
~timeScale?,
~verticalLine?,
(),
),
children,
)
|> ReasonReact.element;
};
module Styles = { module Styles = {
open Css; open Css;
let textOverlay = style([position(`absolute)]); let textOverlay = style([position(`absolute)]);
@ -40,7 +102,7 @@ let make =
~timeScale=?, ~timeScale=?,
) => { ) => {
<div className={Styles.graph(color)}> <div className={Styles.graph(color)}>
<CdfChart__Base <RawChart
?maxX ?maxX
?minX ?minX
?scale ?scale

View File

@ -1,6 +1,5 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { useSize } from 'react-use'; import { useSize } from 'react-use';
import { CdfChartD3 } from './cdfChartD3'; import { CdfChartD3 } from './cdfChartD3';
/** /**

View File

@ -1,4 +1,4 @@
open DistributionTypes; open DistTypes;
let make = let make =
(~guesstimatorString, ~domain=Complete, ~unit=UnspecifiedDistribution, ()) (~guesstimatorString, ~domain=Complete, ~unit=UnspecifiedDistribution, ())

View File

@ -19,12 +19,12 @@ module type dist = {
let minX: t => option(float); let minX: t => option(float);
let maxX: t => option(float); let maxX: t => option(float);
let pointwiseFmap: (float => float, t) => t; let pointwiseFmap: (float => float, t) => t;
let xToY: (float, t) => DistributionTypes.mixedPoint; let xToY: (float, t) => DistTypes.mixedPoint;
let toShape: t => DistributionTypes.shape; let toShape: t => DistTypes.shape;
let toContinuous: t => option(DistributionTypes.continuousShape); let toContinuous: t => option(DistTypes.continuousShape);
let toDiscrete: t => option(DistributionTypes.discreteShape); let toDiscrete: t => option(DistTypes.discreteShape);
let toScaledContinuous: t => option(DistributionTypes.continuousShape); let toScaledContinuous: t => option(DistTypes.continuousShape);
let toScaledDiscrete: t => option(DistributionTypes.discreteShape); let toScaledDiscrete: t => option(DistTypes.discreteShape);
type integral; type integral;
let integral: (~cache: option(integral), t) => integral; let integral: (~cache: option(integral), t) => integral;
@ -62,7 +62,7 @@ module Dist = (T: dist) => {
}; };
module Continuous = { module Continuous = {
type t = DistributionTypes.continuousShape; type t = DistTypes.continuousShape;
let xyShape = (t: t) => t.xyShape; let xyShape = (t: t) => t.xyShape;
let getShape = (t: t) => t.xyShape; let getShape = (t: t) => t.xyShape;
let interpolation = (t: t) => t.interpolation; let interpolation = (t: t) => t.interpolation;
@ -73,8 +73,7 @@ module Continuous = {
interpolation, interpolation,
}; };
let oShapeMap = let oShapeMap =
(fn, {xyShape, interpolation}: t) (fn, {xyShape, interpolation}: t): option(DistTypes.continuousShape) =>
: option(DistributionTypes.continuousShape) =>
fn(xyShape) |> E.O.fmap(xyShape => make(xyShape, interpolation)); fn(xyShape) |> E.O.fmap(xyShape => make(xyShape, interpolation));
let toLinear = (t: t): t => let toLinear = (t: t): t =>
@ -88,8 +87,8 @@ module Continuous = {
module T = module T =
Dist({ Dist({
type t = DistributionTypes.continuousShape; type t = DistTypes.continuousShape;
type integral = DistributionTypes.continuousShape; type integral = DistTypes.continuousShape;
let shapeFn = (fn, t: t) => t |> xyShape |> fn; let shapeFn = (fn, t: t) => t |> xyShape |> fn;
// TODO: Obviously fix this, it's terrible // TODO: Obviously fix this, it's terrible
let integral = (~cache, t) => let integral = (~cache, t) =>
@ -108,11 +107,11 @@ module Continuous = {
let maxX = shapeFn(XYShape.maxX); let maxX = shapeFn(XYShape.maxX);
let pointwiseFmap = (fn, t: t) => let pointwiseFmap = (fn, t: t) =>
t |> xyShape |> XYShape.pointwiseMap(fn) |> fromShape; t |> xyShape |> XYShape.pointwiseMap(fn) |> fromShape;
let toShape = (t: t): DistributionTypes.shape => Continuous(t); let toShape = (t: t): DistTypes.shape => Continuous(t);
// TODO: When Roman's PR comes in, fix this bit. // TODO: When Roman's PR comes in, fix this bit.
let xToY = (f, t) => let xToY = (f, t) =>
shapeFn(CdfLibrary.Distribution.findY(f), t) shapeFn(CdfLibrary.Distribution.findY(f), t)
|> DistributionTypes.MixedPoint.makeContinuous; |> DistTypes.MixedPoint.makeContinuous;
let integralXtoY = (~cache, f, t) => let integralXtoY = (~cache, f, t) =>
t |> integral(~cache) |> shapeFn(CdfLibrary.Distribution.findY(f)); t |> integral(~cache) |> shapeFn(CdfLibrary.Distribution.findY(f));
let toContinuous = t => Some(t); let toContinuous = t => Some(t);
@ -125,8 +124,8 @@ module Continuous = {
module Discrete = { module Discrete = {
module T = module T =
Dist({ Dist({
type t = DistributionTypes.discreteShape; type t = DistTypes.discreteShape;
type integral = DistributionTypes.continuousShape; type integral = DistTypes.continuousShape;
let integral = (~cache, t) => let integral = (~cache, t) =>
cache cache
|> E.O.default( |> E.O.default(
@ -143,14 +142,14 @@ module Discrete = {
let minX = XYShape.minX; let minX = XYShape.minX;
let maxX = XYShape.maxX; let maxX = XYShape.maxX;
let pointwiseFmap = XYShape.pointwiseMap; let pointwiseFmap = XYShape.pointwiseMap;
let toShape = (t: t): DistributionTypes.shape => Discrete(t); let toShape = (t: t): DistTypes.shape => Discrete(t);
let toContinuous = _ => None; let toContinuous = _ => None;
let toDiscrete = t => Some(t); let toDiscrete = t => Some(t);
let toScaledContinuous = t => None; let toScaledContinuous = t => None;
let toScaledDiscrete = t => Some(t); let toScaledDiscrete = t => Some(t);
let xToY = (f, t) => let xToY = (f, t) =>
CdfLibrary.Distribution.findY(f, t) CdfLibrary.Distribution.findY(f, t)
|> DistributionTypes.MixedPoint.makeDiscrete; |> DistTypes.MixedPoint.makeDiscrete;
let integralXtoY = (~cache, f, t) => let integralXtoY = (~cache, f, t) =>
t |> XYShape.accumulateYs |> CdfLibrary.Distribution.findY(f); t |> XYShape.accumulateYs |> CdfLibrary.Distribution.findY(f);
}); });
@ -159,14 +158,13 @@ module Discrete = {
module Mixed = { module Mixed = {
let make = let make =
(~continuous, ~discrete, ~discreteProbabilityMassFraction) (~continuous, ~discrete, ~discreteProbabilityMassFraction)
: DistributionTypes.mixedShape => { : DistTypes.mixedShape => {
continuous, continuous,
discrete, discrete,
discreteProbabilityMassFraction, discreteProbabilityMassFraction,
}; };
let clean = let clean = (t: DistTypes.mixedShape): option(DistTypes.shape) => {
(t: DistributionTypes.mixedShape): option(DistributionTypes.shape) => {
switch (t) { switch (t) {
| { | {
continuous: {xyShape: {xs: [||], ys: [||]}}, continuous: {xyShape: {xs: [||], ys: [||]}},
@ -183,34 +181,34 @@ module Mixed = {
}; };
let scaleDiscreteFn = let scaleDiscreteFn =
({discreteProbabilityMassFraction}: DistributionTypes.mixedShape, f) => ({discreteProbabilityMassFraction}: DistTypes.mixedShape, f) =>
f *. discreteProbabilityMassFraction; f *. discreteProbabilityMassFraction;
let scaleContinuousFn = let scaleContinuousFn =
({discreteProbabilityMassFraction}: DistributionTypes.mixedShape, f) => ({discreteProbabilityMassFraction}: DistTypes.mixedShape, f) =>
f *. (1.0 -. discreteProbabilityMassFraction); f *. (1.0 -. discreteProbabilityMassFraction);
module T = module T =
Dist({ Dist({
type t = DistributionTypes.mixedShape; type t = DistTypes.mixedShape;
type integral = DistributionTypes.continuousShape; type integral = DistTypes.continuousShape;
let minX = ({continuous, discrete}: t) => let minX = ({continuous, discrete}: t) =>
min(Continuous.T.minX(continuous), Discrete.T.minX(discrete)); min(Continuous.T.minX(continuous), Discrete.T.minX(discrete));
let maxX = ({continuous, discrete}: t) => let maxX = ({continuous, discrete}: t) =>
max(Continuous.T.maxX(continuous), Discrete.T.maxX(discrete)); max(Continuous.T.maxX(continuous), Discrete.T.maxX(discrete));
let toShape = (t: t): DistributionTypes.shape => Mixed(t); let toShape = (t: t): DistTypes.shape => Mixed(t);
let toContinuous = ({continuous}: t) => Some(continuous); let toContinuous = ({continuous}: t) => Some(continuous);
let toDiscrete = ({discrete}: t) => Some(discrete); let toDiscrete = ({discrete}: t) => Some(discrete);
let xToY = (f, {discrete, continuous} as t: t) => { let xToY = (f, {discrete, continuous} as t: t) => {
let c = let c =
continuous continuous
|> Continuous.T.xToY(f) |> Continuous.T.xToY(f)
|> DistributionTypes.MixedPoint.fmap(scaleContinuousFn(t)); |> DistTypes.MixedPoint.fmap(scaleContinuousFn(t));
let d = let d =
discrete discrete
|> Discrete.T.xToY(f) |> Discrete.T.xToY(f)
|> DistributionTypes.MixedPoint.fmap(scaleDiscreteFn(t)); |> DistTypes.MixedPoint.fmap(scaleDiscreteFn(t));
DistributionTypes.MixedPoint.add(c, d); DistTypes.MixedPoint.add(c, d);
}; };
let scaleContinuous = let scaleContinuous =
@ -284,8 +282,8 @@ module Mixed = {
module Shape = { module Shape = {
module T = module T =
Dist({ Dist({
type t = DistributionTypes.shape; type t = DistTypes.shape;
type integral = DistributionTypes.continuousShape; type integral = DistTypes.continuousShape;
let mapToAll = (t: t, (fn1, fn2, fn3)) => let mapToAll = (t: t, (fn1, fn2, fn3)) =>
switch (t) { switch (t) {
@ -389,7 +387,7 @@ module Shape = {
}; };
module DistPlus = { module DistPlus = {
open DistributionTypes; open DistTypes;
let make = let make =
( (
~shape, ~shape,
@ -420,8 +418,8 @@ module DistPlus = {
module T = module T =
Dist({ Dist({
type t = DistributionTypes.distPlus; type t = DistTypes.distPlus;
type integral = DistributionTypes.distPlus; type integral = DistTypes.distPlus;
let toShape = ({shape, _}: t) => shape; let toShape = ({shape, _}: t) => shape;
let shapeFn = (fn, t: t) => t |> toShape |> fn; let shapeFn = (fn, t: t) => t |> toShape |> fn;
let toContinuous = shapeFn(Shape.T.toContinuous); let toContinuous = shapeFn(Shape.T.toContinuous);

View File

@ -1,4 +1,4 @@
open DistributionTypes; open DistTypes;
let _lastElement = (a: array('a)) => let _lastElement = (a: array('a)) =>
switch (Belt.Array.size(a)) { switch (Belt.Array.size(a)) {
| 0 => None | 0 => None
@ -24,17 +24,17 @@ let fromArrays = (xs, ys): t => {xs, ys};
let pointwiseMap = (fn, t: t): t => {xs: t.xs, ys: t.ys |> E.A.fmap(fn)}; let pointwiseMap = (fn, t: t): t => {xs: t.xs, ys: t.ys |> E.A.fmap(fn)};
let intersperce = (t1: t, t2: t) => { let intersperce = (t1: t, t2: t) => {
let foo: ref(array((float, float))) = ref([||]); let items: ref(array((float, float))) = ref([||]);
let t1 = zip(t1); let t1 = zip(t1);
let t2 = zip(t2); let t2 = zip(t2);
Belt.Array.forEachWithIndex(t1, (i, item) => { Belt.Array.forEachWithIndex(t1, (i, item) => {
switch (Belt.Array.get(t2, i)) { switch (Belt.Array.get(t2, i)) {
| Some(r) => foo := E.A.append(foo^, [|item, r|]) | Some(r) => items := E.A.append(items^, [|item, r|])
| None => foo := E.A.append(foo^, [|item|]) | None => items := E.A.append(items^, [|item|])
} }
}); });
foo^ |> Belt.Array.unzip |> fromArray; items^ |> Belt.Array.unzip |> fromArray;
}; };
let scaleCdfTo = (~scaleTo=1., t: t) => let scaleCdfTo = (~scaleTo=1., t: t) =>
@ -70,6 +70,9 @@ let _transverseShape = (fn, p: t) => {
let accumulateYs = _transverseShape((aCurrent, aLast) => aCurrent +. aLast); let accumulateYs = _transverseShape((aCurrent, aLast) => aCurrent +. aLast);
let subtractYs = _transverseShape((aCurrent, aLast) => aCurrent -. aLast); let subtractYs = _transverseShape((aCurrent, aLast) => aCurrent -. aLast);
let findY = CdfLibrary.Distribution.findY;
let findX = CdfLibrary.Distribution.findX;
module Range = { module Range = {
// ((lastX, lastY), (nextX, nextY)) // ((lastX, lastY), (nextX, nextY))
type zippedRange = ((float, float), (float, float)); type zippedRange = ((float, float), (float, float));
@ -122,6 +125,3 @@ module Range = {
|> E.O.fmap(fromArray) |> E.O.fmap(fromArray)
|> E.O.fmap(intersperce(t)); |> E.O.fmap(intersperce(t));
}; };
let findY = CdfLibrary.Distribution.findY;
let findX = CdfLibrary.Distribution.findX;

View File

@ -9,7 +9,7 @@ module Value = {
| DateTime(MomentRe.Moment.t) | DateTime(MomentRe.Moment.t)
| FloatPoint(float) | FloatPoint(float)
| Probability(float) | Probability(float)
| DistPlusIngredients(DistributionTypes.distPlusIngredients) | DistPlusIngredients(DistTypes.distPlusIngredients)
| ConditionalArray(array(conditional)) | ConditionalArray(array(conditional))
| FloatCdf(string); | FloatCdf(string);
@ -85,7 +85,7 @@ module ValueCluster = {
[ | `combination(range(MomentRe.Moment.t)) | `item(string)], [ | `combination(range(MomentRe.Moment.t)) | `item(string)],
) )
| Probability([ | `item(string)]) | Probability([ | `item(string)])
| DistPlusIngredients([ | `item(DistributionTypes.distPlusIngredients)]) | DistPlusIngredients([ | `item(DistTypes.distPlusIngredients)])
| ConditionalArray([ | `item(array(conditional))]) | ConditionalArray([ | `item(array(conditional))])
| FloatCdf([ | `item(string)]); | FloatCdf([ | `item(string)]);
}; };

View File

@ -1,42 +0,0 @@
module Styles = {
open Css;
let graph = chartColor =>
style([
selector(".x-axis", [fontSize(`px(9))]),
selector(".x-axis .domain", [display(`none)]),
selector(".x-axis .tick line", [display(`none)]),
selector(".x-axis .tick text", [color(`hex("bfcad4"))]),
selector(".chart .area-path", [SVG.fill(chartColor)]),
selector(".lollipops-line", [SVG.stroke(`hex("bfcad4"))]),
selector(
".lollipops-circle",
[SVG.stroke(`hex("bfcad4")), SVG.fill(`hex("bfcad4"))],
),
selector(".lollipops-x-axis .domain", [display(`none)]),
selector(".lollipops-x-axis .tick line", [display(`none)]),
selector(".lollipops-x-axis .tick text", [display(`none)]),
]);
};
[@react.component]
let make =
(
~data,
~minX=None,
~maxX=None,
~width=300,
~height=50,
~color=`hex("7e9db7"),
) =>
<div className={Styles.graph(color)}>
<ForetoldComponents.CdfChart__Base
width=0
height
?minX
?maxX
marginBottom=20
showVerticalLine=false
showDistributionLines=false
primaryDistribution=data
/>
</div>;

View File

@ -5,16 +5,14 @@ module JS = {
ys: array(float), ys: array(float),
}; };
let distToJs = (d: DistributionTypes.xyShape) => let distToJs = (d: DistTypes.xyShape) => distJs(~xs=d.xs, ~ys=d.ys);
distJs(~xs=d.xs, ~ys=d.ys);
let jsToDist = (d: distJs): DistributionTypes.xyShape => { let jsToDist = (d: distJs): DistTypes.xyShape => {
xs: xsGet(d), xs: xsGet(d),
ys: ysGet(d), ys: ysGet(d),
}; };
let doAsDist = (f, d: DistributionTypes.xyShape) => let doAsDist = (f, d: DistTypes.xyShape) => d |> distToJs |> f |> jsToDist;
d |> distToJs |> f |> jsToDist;
[@bs.module "./CdfLibrary.js"] [@bs.module "./CdfLibrary.js"]
external cdfToPdf: distJs => distJs = "cdfToPdf"; external cdfToPdf: distJs => distJs = "cdfToPdf";

View File

@ -5,7 +5,7 @@ module Internals = {
ys: array(float), ys: array(float),
}; };
let jsToDistDiscrete = (d: discrete): DistributionTypes.discreteShape => { let jsToDistDiscrete = (d: discrete): DistTypes.discreteShape => {
xs: xsGet(d), xs: xsGet(d),
ys: ysGet(d), ys: ysGet(d),
}; };
@ -21,14 +21,14 @@ module Internals = {
|> CdfLibrary.JS.jsToDist |> CdfLibrary.JS.jsToDist
|> Distributions.Continuous.fromShape; |> Distributions.Continuous.fromShape;
let toDiscrete = (r: combined): DistributionTypes.xyShape => let toDiscrete = (r: combined): DistTypes.xyShape =>
discreteGet(r) |> jsToDistDiscrete; discreteGet(r) |> jsToDistDiscrete;
[@bs.module "./GuesstimatorLibrary.js"] [@bs.module "./GuesstimatorLibrary.js"]
external toCombinedFormat: (string, int) => combined = "run"; external toCombinedFormat: (string, int) => combined = "run";
// todo: Format to correct mass, also normalize the pdf. // todo: Format to correct mass, also normalize the pdf.
let toMixedShape = (r: combined): option(DistributionTypes.mixedShape) => { let toMixedShape = (r: combined): option(DistTypes.mixedShape) => {
let assumptions: MixedShapeBuilder.assumptions = { let assumptions: MixedShapeBuilder.assumptions = {
continuous: ADDS_TO_1, continuous: ADDS_TO_1,
discrete: ADDS_TO_CORRECT_PROBABILITY, discrete: ADDS_TO_CORRECT_PROBABILITY,