diff --git a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res index 9631e3aa..e63490ea 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res @@ -164,8 +164,11 @@ module Score = { ) | (Score_Dist(esti'), Score_Dist(answ'), Some(Ok(PSDist(prior'')))) => twoDists(~toPointSetFn, esti', answ')->E.R2.fmap(((esti'', answ'')) => - {estimate: esti'', answer: answ'', prior: Some(prior'')} - ->PointSetDist_Scoring.DistEstimateDistAnswer + { + estimate: esti'', + answer: answ'', + prior: Some(prior''), + }->PointSetDist_Scoring.DistEstimateDistAnswer ) | (Score_Dist(_), _, Some(Ok(PSScalar(_)))) => DistributionTypes.Unreachable->Error | (Score_Dist(esti'), Score_Scalar(answ'), None) => @@ -177,19 +180,20 @@ module Score = { | (Score_Dist(esti'), Score_Scalar(answ'), Some(Ok(PSDist(prior'')))) => toPointSetFn(esti')->E.R.bind(esti'' => {estimate: esti'', answer: answ', prior: Some(prior'')} - ->PointSetDist_Scoring.DistEstimateScalarAnswer - -> Ok + ->PointSetDist_Scoring.DistEstimateScalarAnswer + ->Ok ) | (Score_Scalar(esti'), Score_Dist(answ'), None) => toPointSetFn(answ')->E.R.bind(answ'' => {estimate: esti', answer: answ'', prior: None} - ->PointSetDist_Scoring.ScalarEstimateDistAnswer - -> Ok + ->PointSetDist_Scoring.ScalarEstimateDistAnswer + ->Ok ) | (Score_Scalar(esti'), Score_Dist(answ'), Some(Ok(PSScalar(prior'')))) => toPointSetFn(answ')->E.R.bind(answ'' => {estimate: esti', answer: answ'', prior: Some(prior'')} - ->PointSetDist_Scoring.ScalarEstimateDistAnswer->Ok + ->PointSetDist_Scoring.ScalarEstimateDistAnswer + ->Ok ) | (Score_Scalar(_), _, Some(Ok(PSDist(_)))) => DistributionTypes.Unreachable->Error | (Score_Scalar(esti'), Score_Scalar(answ'), None) => diff --git a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist_Scoring.res b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist_Scoring.res index 5dd312af..a5468b26 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist_Scoring.res +++ b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist_Scoring.res @@ -172,8 +172,10 @@ module TwoScalars = { } } -let twoGenericDistsToTwoPointSetDists = (~toPointSetFn, estimate, answer): result<(pointSetDist, pointSetDist), 'e> => - E.R.merge(toPointSetFn(estimate, ()), toPointSetFn(answer, ())) +let twoGenericDistsToTwoPointSetDists = (~toPointSetFn, estimate, answer): result< + (pointSetDist, pointSetDist), + 'e, +> => E.R.merge(toPointSetFn(estimate, ()), toPointSetFn(answer, ())) let logScore = (args: scoreArgs, ~combineFn, ~integrateFn, ~toMixedFn): result< float, diff --git a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res index 9b22327f..47a067fc 100644 --- a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res +++ b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_GenericDistribution.res @@ -223,7 +223,10 @@ let dispatchToGenericOutput = ( | ("normalize", [EvDistribution(dist)]) => Helpers.toDistFn(Normalize, dist, ~env) | ("klDivergence", [EvDistribution(estimate), EvDistribution(answer)]) => Some( - DistributionOperation.run(FromDist(ToScore(LogScore(Score_Dist(answer), None)), estimate), ~env), + DistributionOperation.run( + FromDist(ToScore(LogScore(Score_Dist(answer), None)), estimate), + ~env, + ), ) | ("klDivergence", [EvDistribution(estimate), EvDistribution(answer), EvDistribution(prior)]) => Some(