Make typechecker happy

Value: [1e-7 to 1e-3]
This commit is contained in:
Quinn Dougherty 2022-05-02 11:55:13 -04:00
parent 58c885f963
commit e2762a0f62
3 changed files with 7 additions and 6 deletions

View File

@ -62,7 +62,7 @@ let reduce = (
fn: (float, float) => result<float, 'e>,
discreteShapes: array<PointSetTypes.discreteShape>,
): result<t, 'e> => {
let merge = combinePointwise(~integralSumCachesFn, fn)
let merge = combinePointwise(~integralSumCachesFn, ~fn)
discreteShapes |> E.A.R.foldM(merge, empty)
}
@ -164,6 +164,7 @@ module T = Dist({
}
let integralEndY = (t: t) => t.integralSumCache |> E.O.default(t |> integral |> Continuous.lastY)
let integralEndYResult = (t: t) => t -> integralEndY -> Ok
let minX = shapeFn(XYShape.T.minX)
let maxX = shapeFn(XYShape.T.maxX)
let toDiscreteProbabilityMassFraction = _ => 1.0
@ -230,7 +231,7 @@ module T = Dist({
let logScore = (base: t, reference: t) => {
combinePointwise(~fn=PointSetDist_Scoring.LogScoring.logScore, base, reference)
|> integralEndY
|> (r => Ok(r))
|> E.R2.bind(integralEndYResult)
// |> (r => Ok(r))
}
})

View File

@ -44,7 +44,7 @@ let combinePointwise = (
t2: t,
): result<t, 'e> => {
let reducedDiscrete =
[t1, t2] |> E.A.fmap(toDiscrete) |> E.A.O.concatSomes |> Discrete.reduce(~integralSumCachesFn)
[t1, t2] |> E.A.fmap(toDiscrete) |> E.A.O.concatSomes |> Discrete.reduce(~integralSumCachesFn, fn) |> E.R.toExn("foo")
let reducedContinuous =
[t1, t2]

View File

@ -86,7 +86,7 @@ let combinePointwise = (
| (Discrete(m1), Discrete(m2)) =>
Discrete.combinePointwise(
~integralSumCachesFn,
fn,
~fn,
m1,
m2,
)->E.R2.fmap(x => PointSetTypes.Discrete(x))