diff --git a/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation.res b/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation.res index 6df75749..319535c1 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation.res +++ b/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation.res @@ -6,7 +6,7 @@ type error = DistributionTypes.error type env = GenericDist.env -let defaultEnv:env = { +let defaultEnv: env = { sampleCount: MagicNumbers.Environment.defaultSampleCount, xyPointLength: MagicNumbers.Environment.defaultXYPointLength, } @@ -90,7 +90,7 @@ module OutputLocal = { } } -let rec run = (~env:env, functionCallInfo: functionCallInfo): outputType => { +let rec run = (~env: env, functionCallInfo: functionCallInfo): outputType => { let {sampleCount, xyPointLength} = env let reCall = (~env=env, ~functionCallInfo=functionCallInfo, ()) => { diff --git a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res index 2d59831a..f536d54d 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res @@ -192,12 +192,10 @@ module Score = { } } - let logScore = ( - ~estimate: t, - ~answer: genericDistOrScalar, - ~prior: option, - ~env: env, - ): result => + let logScore = (~estimate: t, ~answer: genericDistOrScalar, ~prior: option, ~env: env): result< + float, + error, + > => argsMake(~esti=estimate, ~answ=answer, ~prior, ~env)->E.R.bind(x => x->PointSetDist.logScore->E.R2.errMap(y => DistributionTypes.OperationError(y)) ) diff --git a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.resi b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.resi index 24faabe0..fd04212a 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.resi +++ b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.resi @@ -32,7 +32,7 @@ module Score: { ~estimate: t, ~answer: DistributionTypes.DistributionOperation.genericDistOrScalar, ~prior: option, - ~env: env + ~env: env, ) => result } diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res index 357725e1..f42b7705 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res @@ -63,7 +63,10 @@ module Prepare = { } } - let twoDist = (values: ts): result<(DistributionTypes.genericDist, DistributionTypes.genericDist), err> => { + let twoDist = (values: ts): result< + (DistributionTypes.genericDist, DistributionTypes.genericDist), + err, + > => { switch values { | [FRValueDist(a1), FRValueDist(a2)] => Ok(a1, a2) | _ => Error(impossibleError) @@ -95,8 +98,10 @@ module Prepare = { let twoDistOrNumber = (values: ts): result<(frValueDistOrNumber, frValueDistOrNumber), err> => values->ToValueArray.Record.twoArgs->E.R.bind(twoDistOrNumber) - let twoDist = (values: ts): result<(DistributionTypes.genericDist, DistributionTypes.genericDist), err> => - values->ToValueArray.Record.twoArgs->E.R.bind(twoDist) + let twoDist = (values: ts): result< + (DistributionTypes.genericDist, DistributionTypes.genericDist), + err, + > => values->ToValueArray.Record.twoArgs->E.R.bind(twoDist) } } @@ -144,8 +149,7 @@ module Prepare = { module Process = { module DistOrNumberToDist = { module Helpers = { - let toSampleSet = (r, env: GenericDist.env) => - GenericDist.toSampleSetDist(r, env.sampleCount) + let toSampleSet = (r, env: GenericDist.env) => GenericDist.toSampleSetDist(r, env.sampleCount) let mapFnResult = r => switch r {