From 9f103f5cbe8930cc43956201f99308c012b1f390 Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Tue, 20 Sep 2022 21:08:42 +0400 Subject: [PATCH] 3-arg fnDefinition --- .../src/rescript/FR/FR_Builtin.res | 2 +- .../src/rescript/FR/FR_Danger.res | 6 +++--- .../squiggle-lang/src/rescript/FR/FR_Date.res | 6 +++--- .../squiggle-lang/src/rescript/FR/FR_Dict.res | 12 ++++++------ .../squiggle-lang/src/rescript/FR/FR_Dist.res | 8 ++++---- .../squiggle-lang/src/rescript/FR/FR_Fn.res | 2 +- .../src/rescript/FR/FR_GenericDist.res | 2 +- .../squiggle-lang/src/rescript/FR/FR_List.res | 18 +++++++++--------- .../src/rescript/FR/FR_Number.res | 2 +- .../src/rescript/FR/FR_Pointset.res | 8 ++++---- .../src/rescript/FR/FR_Sampleset.res | 18 +++++++++--------- .../src/rescript/FR/FR_Scoring.res | 6 +++--- .../squiggle-lang/src/rescript/FR/FR_Units.res | 2 +- .../FunctionRegistry/FunctionRegistry_Core.res | 3 +-- .../FunctionRegistry_Helpers.res | 14 +++++++------- 15 files changed, 54 insertions(+), 55 deletions(-) diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Builtin.res b/packages/squiggle-lang/src/rescript/FR/FR_Builtin.res index aee18e8b..84e6a50f 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Builtin.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Builtin.res @@ -14,7 +14,7 @@ let makeFnMany = (name: string, definitions: array) => ~nameSpace, ~requiresNamespace=false, ~definitions=definitions->Js.Array2.map(({inputs, fn}) => - FnDefinition.make(~name, ~inputs, ~run=(inputs, _, _, _) => fn(inputs), ()) + FnDefinition.make(~name, ~inputs, ~run=(inputs, _, _) => fn(inputs), ()) ), (), ) diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Danger.res b/packages/squiggle-lang/src/rescript/FR/FR_Danger.res index f457a8f7..2d60f556 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Danger.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Danger.res @@ -165,7 +165,7 @@ module Integration = { FnDefinition.make( ~name="integrateFunctionBetweenWithNumIntegrationPoints", ~inputs=[FRTypeLambda, FRTypeNumber, FRTypeNumber, FRTypeNumber], - ~run=(inputs, _, env, reducer) => { + ~run=(inputs, env, reducer) => { let result = switch inputs { | [_, _, _, IEvNumber(0.0)] => "Integration error 4 in Danger.integrate: Increment can't be 0." @@ -209,7 +209,7 @@ module Integration = { FnDefinition.make( ~name="integrateFunctionBetweenWithEpsilon", ~inputs=[FRTypeLambda, FRTypeNumber, FRTypeNumber, FRTypeNumber], - ~run=(inputs, _, env, reducer) => { + ~run=(inputs, env, reducer) => { let result = switch inputs { | [_, _, _, IEvNumber(0.0)] => "Integration error in Danger.integrate: Increment can't be 0." @@ -403,7 +403,7 @@ module DiminishingReturns = { FnDefinition.make( ~name="optimalAllocationGivenDiminishingMarginalReturnsForManyFunctions", ~inputs=[FRTypeArray(FRTypeLambda), FRTypeNumber, FRTypeNumber], - ~run=(inputs, _, environment, reducer) => + ~run=(inputs, environment, reducer) => switch inputs { | [IEvArray(innerlambdas), IEvNumber(funds), IEvNumber(approximateIncrement)] => { let individuallyWrappedLambdas = E.A.fmap(innerLambda => { diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Date.res b/packages/squiggle-lang/src/rescript/FR/FR_Date.res index bf7e2120..c9732980 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Date.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Date.res @@ -10,7 +10,7 @@ let makeFn = ( ~name, ~nameSpace="", ~requiresNamespace=false, - ~definitions=[FnDefinition.make(~name, ~inputs, ~run=(inputs, _, _, _) => fn(inputs), ())], + ~definitions=[FnDefinition.make(~name, ~inputs, ~run=(inputs, _, _) => fn(inputs), ())], (), ) @@ -23,7 +23,7 @@ let makeNumberToDurationFn = (name: string, fn: float => DateTime.Duration.t) => FnDefinition.make( ~name, ~inputs=[FRTypeNumber], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvNumber(t)] => IEvTimeDuration(fn(t))->Ok | _ => Error(impossibleError) @@ -43,7 +43,7 @@ let makeDurationToNumberFn = (name: string, fn: DateTime.Duration.t => float) => FnDefinition.make( ~name, ~inputs=[FRTypeTimeDuration], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvTimeDuration(t)] => IEvNumber(fn(t))->Ok | _ => Error(impossibleError) diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Dict.res b/packages/squiggle-lang/src/rescript/FR/FR_Dict.res index f1f258ee..13bcfe33 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Dict.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Dict.res @@ -48,7 +48,7 @@ let library = [ FnDefinition.make( ~name="merge", ~inputs=[FRTypeDict(FRTypeAny), FRTypeDict(FRTypeAny)], - ~run=(inputs, _, _, _) => { + ~run=(inputs, _, _) => { switch inputs { | [IEvRecord(d1), IEvRecord(d2)] => Internals.mergeMany([d1, d2])->Ok | _ => impossibleError->Error @@ -70,7 +70,7 @@ let library = [ FnDefinition.make( ~name="mergeMany", ~inputs=[FRTypeArray(FRTypeDict(FRTypeAny))], - ~run=(inputs, _, _, _) => { + ~run=(inputs, _, _) => { switch inputs { | [IEvArray(dicts)] => { dicts->Belt.Array.map(dictValue => switch dictValue { @@ -96,7 +96,7 @@ let library = [ FnDefinition.make( ~name="keys", ~inputs=[FRTypeDict(FRTypeAny)], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvRecord(d1)] => Internals.keys(d1)->Ok | _ => Error(impossibleError) @@ -116,7 +116,7 @@ let library = [ FnDefinition.make( ~name="values", ~inputs=[FRTypeDict(FRTypeAny)], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvRecord(d1)] => Internals.values(d1)->Ok | _ => Error(impossibleError) @@ -136,7 +136,7 @@ let library = [ FnDefinition.make( ~name="toList", ~inputs=[FRTypeDict(FRTypeAny)], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvRecord(dict)] => dict->Internals.toList->Ok | _ => Error(impossibleError) @@ -156,7 +156,7 @@ let library = [ FnDefinition.make( ~name="fromList", ~inputs=[FRTypeArray(FRTypeArray(FRTypeAny))], - ~run=(inputs, _, _, _) => { + ~run=(inputs, _, _) => { switch inputs { | [IEvArray(items)] => Internals.fromList(items) | _ => Error(impossibleError) diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Dist.res b/packages/squiggle-lang/src/rescript/FR/FR_Dist.res index 1ff4c3c5..3a7504f2 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Dist.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Dist.res @@ -22,7 +22,7 @@ module DistributionCreation = { FnDefinition.make( ~name, ~inputs=[FRTypeDistOrNumber, FRTypeDistOrNumber], - ~run=(inputs, _, env, _) => + ~run=(inputs, env, _) => inputs->Prepare.ToValueTuple.twoDistOrNumber->process(~fn, ~env), (), ) @@ -32,7 +32,7 @@ module DistributionCreation = { FnDefinition.make( ~name, ~inputs=[FRTypeRecord([("p5", FRTypeDistOrNumber), ("p95", FRTypeDistOrNumber)])], - ~run=(inputs, _, env, _) => + ~run=(inputs, env, _) => inputs->Prepare.ToValueTuple.Record.twoDistOrNumber(("p5", "p95"))->process(~fn, ~env), (), ) @@ -42,7 +42,7 @@ module DistributionCreation = { FnDefinition.make( ~name, ~inputs=[FRTypeRecord([("mean", FRTypeDistOrNumber), ("stdev", FRTypeDistOrNumber)])], - ~run=(inputs, _, env, _) => + ~run=(inputs, env, _) => inputs->Prepare.ToValueTuple.Record.twoDistOrNumber(("mean", "stdev"))->process(~fn, ~env), (), ) @@ -60,7 +60,7 @@ module DistributionCreation = { FnDefinition.make( ~name, ~inputs=[FRTypeDistOrNumber], - ~run=(inputs, _, env, _) => + ~run=(inputs, env, _) => inputs->Prepare.ToValueTuple.oneDistOrNumber->process(~fn, ~env), (), ) diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Fn.res b/packages/squiggle-lang/src/rescript/FR/FR_Fn.res index efd64bff..66d20c1f 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Fn.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Fn.res @@ -49,7 +49,7 @@ let library = [ FnDefinition.make( ~name="declare", ~inputs=[Declaration.frType], - ~run=(inputs, _, _, _) => { + ~run=(inputs, _, _) => { inputs->getOrError(0)->E.R.bind(Declaration.fromExpressionValue)->E.R2.errMap(wrapError) }, (), diff --git a/packages/squiggle-lang/src/rescript/FR/FR_GenericDist.res b/packages/squiggle-lang/src/rescript/FR/FR_GenericDist.res index 443e101b..6f98d132 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_GenericDist.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_GenericDist.res @@ -326,7 +326,7 @@ let makeProxyFn = (name: string, inputs: array) => { FnDefinition.make( ~name, ~inputs, - ~run=(inputs, _, env, _) => Old.dispatch((name, inputs), env), + ~run=(inputs, env, _) => Old.dispatch((name, inputs), env), (), ), ], diff --git a/packages/squiggle-lang/src/rescript/FR/FR_List.res b/packages/squiggle-lang/src/rescript/FR/FR_List.res index f4942b00..fb675417 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_List.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_List.res @@ -86,7 +86,7 @@ let library = [ FnDefinition.make( ~name="make", ~inputs=[FRTypeNumber, FRTypeAny], - ~run=(inputs, _, _, _) => { + ~run=(inputs, _, _) => { switch inputs { | [IEvNumber(number), value] => Internals.makeFromNumber(number, value)->Ok | _ => Error(impossibleError) @@ -107,7 +107,7 @@ let library = [ FnDefinition.make( ~name="upTo", ~inputs=[FRTypeNumber, FRTypeNumber], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvNumber(low), IEvNumber(high)] => Internals.upTo(low, high)->Ok | _ => impossibleError->Error @@ -126,7 +126,7 @@ let library = [ FnDefinition.make( ~name="first", ~inputs=[FRTypeArray(FRTypeAny)], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvArray(array)] => Internals.first(array)->E.R2.errMap(wrapError) | _ => Error(impossibleError) @@ -145,7 +145,7 @@ let library = [ FnDefinition.make( ~name="last", ~inputs=[FRTypeArray(FRTypeAny)], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvArray(array)] => Internals.last(array)->E.R2.errMap(wrapError) | _ => Error(impossibleError) @@ -165,7 +165,7 @@ let library = [ FnDefinition.make( ~name="reverse", ~inputs=[FRTypeArray(FRTypeAny)], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvArray(array)] => Internals.reverse(array)->Ok | _ => Error(impossibleError) @@ -185,7 +185,7 @@ let library = [ FnDefinition.make( ~name="map", ~inputs=[FRTypeArray(FRTypeAny), FRTypeLambda], - ~run=(inputs, _, env, reducer) => + ~run=(inputs, env, reducer) => switch inputs { | [IEvArray(array), IEvLambda(lambda)] => Ok(Internals.map(array, lambda, env, reducer)) | _ => Error(impossibleError) @@ -204,7 +204,7 @@ let library = [ FnDefinition.make( ~name="reduce", ~inputs=[FRTypeArray(FRTypeAny), FRTypeAny, FRTypeLambda], - ~run=(inputs, _, env, reducer) => + ~run=(inputs, env, reducer) => switch inputs { | [IEvArray(array), initialValue, IEvLambda(lambda)] => Ok(Internals.reduce(array, initialValue, lambda, env, reducer)) @@ -224,7 +224,7 @@ let library = [ FnDefinition.make( ~name="reduceReverse", ~inputs=[FRTypeArray(FRTypeAny), FRTypeAny, FRTypeLambda], - ~run=(inputs, _, env, reducer) => + ~run=(inputs, env, reducer) => switch inputs { | [IEvArray(array), initialValue, IEvLambda(lambda)] => Ok(Internals.reduceReverse(array, initialValue, lambda, env, reducer)) @@ -244,7 +244,7 @@ let library = [ FnDefinition.make( ~name="filter", ~inputs=[FRTypeArray(FRTypeAny), FRTypeLambda], - ~run=(inputs, _, env, reducer) => + ~run=(inputs, env, reducer) => switch inputs { | [IEvArray(array), IEvLambda(lambda)] => Ok(Internals.filter(array, lambda, env, reducer)) diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Number.res b/packages/squiggle-lang/src/rescript/FR/FR_Number.res index 91146ac5..336a3f2b 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Number.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Number.res @@ -9,7 +9,7 @@ module ArrayNumberDist = { FnDefinition.make( ~name, ~inputs=[FRTypeArray(FRTypeNumber)], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => inputs ->Prepare.ToTypedArray.numbers ->E.R.bind(r => E.A.length(r) === 0 ? Error("List is empty") : Ok(r)) diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res b/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res index dc428f0c..8996ac3b 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res @@ -60,7 +60,7 @@ let library = [ FnDefinition.make( ~name="fromDist", ~inputs=[FRTypeDist], - ~run=(inputs, _, env, _) => + ~run=(inputs, env, _) => switch inputs { | [IEvDistribution(dist)] => GenericDist.toPointSet( @@ -89,7 +89,7 @@ let library = [ FnDefinition.make( ~name="mapY", ~inputs=[FRTypeDist, FRTypeLambda], - ~run=(inputs, _, env, reducer) => + ~run=(inputs, env, reducer) => switch inputs { | [IEvDistribution(PointSet(dist)), IEvLambda(lambda)] => Internal.mapY(dist, lambda, env, reducer) @@ -117,7 +117,7 @@ let library = [ FnDefinition.make( ~name="makeContinuous", ~inputs=[FRTypeArray(FRTypeRecord([("x", FRTypeNumeric), ("y", FRTypeNumeric)]))], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => inputsToDist(inputs, r => Continuous(Continuous.make(r)))->E.R2.errMap(wrapError), (), ), @@ -141,7 +141,7 @@ let library = [ FnDefinition.make( ~name="makeDiscrete", ~inputs=[FRTypeArray(FRTypeRecord([("x", FRTypeNumeric), ("y", FRTypeNumeric)]))], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => inputsToDist(inputs, r => Discrete(Discrete.make(r)))->E.R2.errMap(wrapError), (), ), diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res b/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res index f21a6fde..5bbfb506 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res @@ -89,7 +89,7 @@ let libaryBase = [ FnDefinition.make( ~name="fromDist", ~inputs=[FRTypeDist], - ~run=(inputs, _, environment, _) => + ~run=(inputs, environment, _) => switch inputs { | [IEvDistribution(dist)] => GenericDist.toSampleSetDist(dist, environment.sampleCount) @@ -113,7 +113,7 @@ let libaryBase = [ FnDefinition.make( ~name="fromList", ~inputs=[FRTypeArray(FRTypeNumber)], - ~run=(inputs, _, _, _) => { + ~run=(inputs, _, _) => { let sampleSet = inputs->Prepare.ToTypedArray.numbers |> E.R2.bind(r => SampleSetDist.make(r)->E.R2.errMap(_ => "AM I HERE? WHYERE AMI??") @@ -138,7 +138,7 @@ let libaryBase = [ FnDefinition.make( ~name="toList", ~inputs=[FRTypeDist], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvDistribution(SampleSet(dist))] => dist->E.A2.fmap(Wrappers.evNumber)->Wrappers.evArray->Ok @@ -159,7 +159,7 @@ let libaryBase = [ FnDefinition.make( ~name="fromFn", ~inputs=[FRTypeLambda], - ~run=(inputs, _, environment, reducer) => + ~run=(inputs, environment, reducer) => switch inputs { | [IEvLambda(lambda)] => switch Internal.fromFn(lambda, environment, reducer) { @@ -183,7 +183,7 @@ let libaryBase = [ FnDefinition.make( ~name="map", ~inputs=[FRTypeDist, FRTypeLambda], - ~run=(inputs, _, environment, reducer) => + ~run=(inputs, environment, reducer) => switch inputs { | [IEvDistribution(SampleSet(dist)), IEvLambda(lambda)] => Internal.map1(dist, lambda, environment, reducer) @@ -206,7 +206,7 @@ let libaryBase = [ FnDefinition.make( ~name="map2", ~inputs=[FRTypeDist, FRTypeDist, FRTypeLambda], - ~run=(inputs, _, environment, reducer) => { + ~run=(inputs, environment, reducer) => { switch inputs { | [ IEvDistribution(SampleSet(dist1)), @@ -234,7 +234,7 @@ let libaryBase = [ FnDefinition.make( ~name="map3", ~inputs=[FRTypeDist, FRTypeDist, FRTypeDist, FRTypeLambda], - ~run=(inputs, _, environment, reducer) => + ~run=(inputs, environment, reducer) => switch inputs { | [ IEvDistribution(SampleSet(dist1)), @@ -262,7 +262,7 @@ let libaryBase = [ FnDefinition.make( ~name="mapN", ~inputs=[FRTypeArray(FRTypeDist), FRTypeLambda], - ~run=(inputs, _, environment, reducer) => + ~run=(inputs, environment, reducer) => switch inputs { | [IEvArray(dists), IEvLambda(lambda)] => Internal.mapN(dists, lambda, environment, reducer) @@ -280,7 +280,7 @@ module Comparison = { FnDefinition.make( ~name, ~inputs, - ~run=(inputs, _, _, _) => { + ~run=(inputs, _, _) => { run(inputs) }, (), diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Scoring.res b/packages/squiggle-lang/src/rescript/FR/FR_Scoring.res index 450b9d63..63589e83 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Scoring.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Scoring.res @@ -30,7 +30,7 @@ let library = [ ("prior", FRTypeDist), ]), ], - ~run=(inputs, _, environment, _) => { + ~run=(inputs, environment, _) => { switch FunctionRegistry_Helpers.Prepare.ToValueArray.Record.threeArgs(inputs, ("estimate", "answer", "prior")) { | Ok([IEvDistribution(estimate), IEvDistribution(d), IEvDistribution(prior)]) => runScoring(estimate, Score_Dist(d), Some(prior), environment) @@ -49,7 +49,7 @@ let library = [ FnDefinition.make( ~name="logScore", ~inputs=[FRTypeRecord([("estimate", FRTypeDist), ("answer", FRTypeDistOrNumber)])], - ~run=(inputs, _, environment, _) => { + ~run=(inputs, environment, _) => { switch FunctionRegistry_Helpers.Prepare.ToValueArray.Record.twoArgs(inputs, ("estimate", "answer")) { | Ok([IEvDistribution(estimate), IEvDistribution(d)]) => runScoring(estimate, Score_Dist(d), None, environment) @@ -74,7 +74,7 @@ let library = [ FnDefinition.make( ~name="klDivergence", ~inputs=[FRTypeDist, FRTypeDist], - ~run=(inputs, _, environment, _) => { + ~run=(inputs, environment, _) => { switch inputs { | [IEvDistribution(estimate), IEvDistribution(d)] => runScoring(estimate, Score_Dist(d), None, environment) diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Units.res b/packages/squiggle-lang/src/rescript/FR/FR_Units.res index 3935b197..8934b5d8 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Units.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Units.res @@ -9,7 +9,7 @@ let makeUnitFn = (name: string, multiplier: float) => { FnDefinition.make( ~name="fromUnit_" ++ name, ~inputs=[FRTypeNumber], - ~run=(inputs, _, _, _) => { + ~run=(inputs, _, _) => { switch inputs { | [IEvNumber(f)] => IEvNumber(f *. multiplier)->Ok | _ => FunctionRegistry_Helpers.impossibleError->Error diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res index 128d0b8e..e6929761 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res @@ -30,7 +30,6 @@ type fnDefinition = { inputs: array, run: ( array, - unit, Reducer_T.environment, Reducer_T.reducerFn, ) => result, @@ -130,7 +129,7 @@ module FnDefinition = { reducer: Reducer_T.reducerFn, ) => { switch t->isMatch(args) { - | true => t.run(args, (), env, reducer) + | true => t.run(args, env, reducer) | false => REOther("Incorrect Types")->Error } } diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res index 3b1bd7d7..a5a0f523 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Helpers.res @@ -220,7 +220,7 @@ module DefineFn = { FnDefinition.make( ~name, ~inputs=[FRTypeNumber], - ~run=(inputs, _, _, _) => { + ~run=(inputs, _, _) => { switch inputs { | [IEvNumber(x)] => fn(x)->IEvNumber->Ok | _ => Error(impossibleError) @@ -232,7 +232,7 @@ module DefineFn = { FnDefinition.make( ~name, ~inputs=[FRTypeNumber, FRTypeNumber], - ~run=(inputs, _, _, _) => { + ~run=(inputs, _, _) => { switch inputs { | [IEvNumber(x), IEvNumber(y)] => fn(x, y)->IEvNumber->Ok | _ => Error(impossibleError) @@ -244,7 +244,7 @@ module DefineFn = { FnDefinition.make( ~name, ~inputs=[FRTypeNumber, FRTypeNumber, FRTypeNumber], - ~run=(inputs, _, _, _) => { + ~run=(inputs, _, _) => { switch inputs { | [IEvNumber(x), IEvNumber(y), IEvNumber(z)] => fn(x, y, z)->IEvNumber->Ok | _ => Error(impossibleError) @@ -292,7 +292,7 @@ module Make = { FnDefinition.make( ~name, ~inputs=[FRTypeNumber], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvNumber(x)] => fn(x)->IEvNumber->Ok | _ => Error(impossibleError) @@ -322,7 +322,7 @@ module Make = { FnDefinition.make( ~name, ~inputs=[FRTypeNumber, FRTypeNumber], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvNumber(x), IEvNumber(y)] => fn(x, y)->IEvNumber->Ok | _ => Error(impossibleError) @@ -352,7 +352,7 @@ module Make = { FnDefinition.make( ~name, ~inputs=[FRTypeNumber, FRTypeNumber], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvNumber(x), IEvNumber(y)] => fn(x, y)->IEvBool->Ok | _ => Error(impossibleError) @@ -382,7 +382,7 @@ module Make = { FnDefinition.make( ~name, ~inputs=[FRTypeBool, FRTypeBool], - ~run=(inputs, _, _, _) => + ~run=(inputs, _, _) => switch inputs { | [IEvBool(x), IEvBool(y)] => fn(x, y)->IEvBool->Ok | _ => Error(impossibleError)