From d8b1e0d5ff07c54cc174192e1bf808384fc17a0d Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Wed, 13 Jul 2022 10:11:59 -0700 Subject: [PATCH] Formatted code --- .../Distributions/DistributionOperation.res | 4 ++-- .../src/rescript/Distributions/GenericDist.res | 10 ++++------ .../src/rescript/Distributions/GenericDist.resi | 2 +- .../FunctionRegistry/FunctionRegistry_Helpers.res | 14 +++++++++----- 4 files changed, 16 insertions(+), 14 deletions(-) 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 {