squiggle/src/core/GenericDistribution.re
2020-02-22 23:55:43 +00:00

36 lines
765 B
ReasonML

open DistributionTypes;
let make =
(
~generationSource,
~probabilityType=Pdf,
~domain=Complete,
~unit=UnspecifiedDistribution,
(),
)
: genericDistribution => {
generationSource,
probabilityType,
domain,
unit,
};
let toComplexPower = (~sampleCount, t: genericDistribution) => {
let shape =
switch (t.generationSource) {
| GuesstimatorString(s) =>
Guesstimator.stringToMixedShape(~string=s, ~sampleCount, ())
|> E.O.bind(_, DistFunctor.Mixed.clean)
| Shape(shape) => Some(shape)
};
shape
|> E.O.fmap(shape =>
DistFunctor.ComplexPower.make(
~shape,
~domain=t.domain,
~unit=t.unit,
~guesstimatorString=None,
(),
)
);
};