From d88fb9576748d1236e69015ac78689b64378b7b8 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sat, 16 Jul 2022 18:11:38 -0700 Subject: [PATCH] Simple reformatting, got RequiresNamespace to work --- .../__tests__/FunctionRegistry_test.res | 5 ++--- .../FunctionRegistry_Core.res | 16 ++++++++------ .../FunctionRegistry_Library.res | 2 +- .../FunctionRegistry/Library/FR_Dict.res | 12 +++++----- .../FunctionRegistry/Library/FR_Dist.res | 9 +++----- .../FunctionRegistry/Library/FR_Fn.res | 2 +- .../FunctionRegistry/Library/FR_List.res | 10 ++++----- .../FunctionRegistry/Library/FR_Number.res | 22 +++++++++++++++++-- .../FunctionRegistry/Library/FR_Pointset.res | 4 ++-- .../FunctionRegistry/Library/FR_Scoring.res | 7 +++--- .../ReducerInterface_ExternalLibrary.res | 9 +++++--- 11 files changed, 58 insertions(+), 40 deletions(-) diff --git a/packages/squiggle-lang/__tests__/FunctionRegistry_test.res b/packages/squiggle-lang/__tests__/FunctionRegistry_test.res index 47d3005a..2909f7d1 100644 --- a/packages/squiggle-lang/__tests__/FunctionRegistry_test.res +++ b/packages/squiggle-lang/__tests__/FunctionRegistry_test.res @@ -18,11 +18,11 @@ module FooImplementation = { let fn = Function.make( ~name="add", ~nameSpace="Foo", + ~requiresNamespace=false, ~examples=["Foo.add(1, 2)", "Foo.add(1, 2, 3)"], ~output=EvtNumber, ~definitions=[ FnDefinition.make( - ~requiresNamespace=false, ~name="add", ~inputs=[FRTypeNumber, FRTypeNumber], ~run=(_, inputs, _) => @@ -33,7 +33,6 @@ module FooImplementation = { (), ), FnDefinition.make( - ~requiresNamespace=true, ~name="add", ~inputs=[FRTypeNumber, FRTypeNumber, FRTypeNumber], ~run=(_, inputs, _) => @@ -92,4 +91,4 @@ describe("Fn auto-testing", () => { let expectedOutputType = FooImplementation.fn.output |> E.O.toExn("") expect(responseType)->toEqual(Ok(expectedOutputType)) }) -}) \ No newline at end of file +}) diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res index d2d2a080..887ac3f7 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res @@ -41,7 +41,6 @@ and frValueDictParam = (string, frValue) and frValueDistOrNumber = FRValueNumber(float) | FRValueDist(DistributionTypes.genericDist) type fnDefinition = { - requiresNamespace: bool, name: string, inputs: array, run: ( @@ -54,6 +53,7 @@ type fnDefinition = { type function = { name: string, definitions: array, + requiresNamespace: bool, nameSpace: string, output: option, examples: array, @@ -352,9 +352,8 @@ module FnDefinition = { let toLambda = (t: t) => Reducer_Module.convertOptionToFfiFn(t.name, toFfiFn(t))->Reducer_Module.eLambdaFFIValue - let make = (~requiresNamespace=true, ~name, ~inputs, ~run, ()): t => { + let make = (~name, ~inputs, ~run, ()): t => { name: name, - requiresNamespace: requiresNamespace, inputs: inputs, run: run, } @@ -374,6 +373,7 @@ module Function = { let make = ( ~name, ~nameSpace, + ~requiresNamespace, ~definitions, ~examples=?, ~output=?, @@ -387,6 +387,7 @@ module Function = { output: output, examples: examples |> E.O.default([]), isExperimental: isExperimental, + requiresNamespace: requiresNamespace, description: description, } @@ -427,6 +428,9 @@ module NameSpace = { module Registry = { let toJson = (r: registry) => r->E.A2.fmap(Function.toJson) + + let exportedSubset = (r: registry): registry => r |> E.A.filter(r => !r.requiresNamespace) + let definitionsWithFunctions = (r: registry) => r->E.A2.fmap(fn => fn.definitions->E.A2.fmap(def => (def, fn)))->E.A.concatMany @@ -442,7 +446,6 @@ module Registry = { ~env: GenericDist.env, ) => { let matchToDef = m => Matcher.Registry.matchToDef(registry, m) - //Js.log(toSimple(registry)) let showNameMatchDefinitions = matches => { let defs = matches @@ -460,17 +463,16 @@ module Registry = { } } - //todo: get namespace from project. let allNamespaces = (t: registry) => t->E.A2.fmap(r => r.nameSpace)->E.A.uniq let makeModules = (prevBindings: Reducer_Module.t, t: registry): Reducer_Module.t => { let nameSpaces = allNamespaces(t) let nameSpaceBindings = nameSpaces->E.A2.fmap(nameSpace => { - let foo: NameSpace.t = { + let namespaceModule: NameSpace.t = { name: nameSpace, functions: t->E.A2.filter(r => r.nameSpace == nameSpace), } - (nameSpace, NameSpace.toModule(foo)) + (nameSpace, NameSpace.toModule(namespaceModule)) }) E.A.reduce(nameSpaceBindings, prevBindings, (acc, (name, fn)) => acc->Reducer_Module.defineModule(name, fn) diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Library.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Library.res index 949837b5..3c74398a 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Library.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Library.res @@ -5,5 +5,5 @@ let registry = Belt.Array.concatMany([ FR_List.library, FR_Number.library, FR_Pointset.library, - FR_Scoring.library + FR_Scoring.library, ]) diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dict.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dict.res index c8d28a78..fdb8e191 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dict.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dict.res @@ -45,11 +45,11 @@ let library = [ Function.make( ~name="merge", ~nameSpace, + ~requiresNamespace=true, ~output=EvtRecord, ~examples=[`Dict.merge({a: 1, b: 2}, {c: 3, d: 4})`], ~definitions=[ FnDefinition.make( - ~requiresNamespace=true, ~name="merge", ~inputs=[FRTypeDict(FRTypeAny), FRTypeDict(FRTypeAny)], ~run=(inputs, _, _) => { @@ -67,11 +67,11 @@ let library = [ Function.make( ~name="mergeMany", ~nameSpace, + ~requiresNamespace=true, ~output=EvtRecord, ~examples=[`Dict.mergeMany([{a: 1, b: 2}, {c: 3, d: 4}])`], ~definitions=[ FnDefinition.make( - ~requiresNamespace=true, ~name="mergeMany", ~inputs=[FRTypeArray(FRTypeDict(FRTypeAny))], ~run=(_, inputs, _) => @@ -89,11 +89,11 @@ let library = [ Function.make( ~name="keys", ~nameSpace, + ~requiresNamespace=true, ~output=EvtArray, ~examples=[`Dict.keys({a: 1, b: 2})`], ~definitions=[ FnDefinition.make( - ~requiresNamespace=true, ~name="keys", ~inputs=[FRTypeDict(FRTypeAny)], ~run=(inputs, _, _) => @@ -109,11 +109,11 @@ let library = [ Function.make( ~name="values", ~nameSpace, + ~requiresNamespace=true, ~output=EvtArray, ~examples=[`Dict.values({a: 1, b: 2})`], ~definitions=[ FnDefinition.make( - ~requiresNamespace=true, ~name="values", ~inputs=[FRTypeDict(FRTypeAny)], ~run=(inputs, _, _) => @@ -129,11 +129,11 @@ let library = [ Function.make( ~name="toList", ~nameSpace, + ~requiresNamespace=true, ~output=EvtArray, ~examples=[`Dict.toList({a: 1, b: 2})`], ~definitions=[ FnDefinition.make( - ~requiresNamespace=true, ~name="toList", ~inputs=[FRTypeDict(FRTypeAny)], ~run=(inputs, _, _) => @@ -149,11 +149,11 @@ let library = [ Function.make( ~name="fromList", ~nameSpace, + ~requiresNamespace=true, ~output=EvtRecord, ~examples=[`Dict.fromList({a: 1, b: 2})`], ~definitions=[ FnDefinition.make( - ~requiresNamespace=true, ~name="fromList", ~inputs=[FRTypeArray(FRTypeArray(FRTypeAny))], ~run=(inputs, _, _) => diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dist.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dist.res index 35e17dd3..424983d8 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dist.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Dist.res @@ -5,9 +5,10 @@ let twoArgs = E.Tuple2.toFnCall module DistributionCreation = { let nameSpace = "Dist" let output = ReducerInterface_InternalExpressionValue.EvtDistribution + let requiresNamespace = false let fnMake = (~name, ~examples, ~definitions) => { - Function.make(~name, ~nameSpace, ~output, ~examples, ~definitions, ()) + Function.make(~name, ~nameSpace, ~output, ~examples, ~definitions, ~requiresNamespace, ()) } module TwoArgDist = { @@ -18,7 +19,6 @@ module DistributionCreation = { let make = (name, fn) => { FnDefinition.make( - ~requiresNamespace=false, ~name, ~inputs=[FRTypeDistOrNumber, FRTypeDistOrNumber], ~run=(_, inputs, env) => inputs->Prepare.ToValueTuple.twoDistOrNumber->process(~fn, ~env), @@ -28,7 +28,6 @@ module DistributionCreation = { let makeRecordP5P95 = (name, fn) => { FnDefinition.make( - ~requiresNamespace=false, ~name, ~inputs=[FRTypeRecord([("p5", FRTypeDistOrNumber), ("p95", FRTypeDistOrNumber)])], ~run=(_, inputs, env) => @@ -40,7 +39,6 @@ module DistributionCreation = { let makeRecordMeanStdev = (name, fn) => { FnDefinition.make( ~name, - ~requiresNamespace=false, ~inputs=[FRTypeRecord([("mean", FRTypeDistOrNumber), ("stdev", FRTypeDistOrNumber)])], ~run=(_, inputs, env) => inputs->Prepare.ToValueTuple.Record.twoDistOrNumber->process(~fn, ~env), @@ -57,7 +55,6 @@ module DistributionCreation = { let make = (name, fn) => FnDefinition.make( - ~requiresNamespace=false, ~name, ~inputs=[FRTypeDistOrNumber], ~run=(_, inputs, env) => inputs->Prepare.ToValueTuple.oneDistOrNumber->process(~fn, ~env), @@ -152,4 +149,4 @@ module DistributionCreation = { ] } -let library = DistributionCreation.library \ No newline at end of file +let library = DistributionCreation.library diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Fn.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Fn.res index b30cac2d..1e423f52 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Fn.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Fn.res @@ -34,6 +34,7 @@ let library = [ Function.make( ~name="declare", ~nameSpace, + ~requiresNamespace=true, ~description="Adds metadata to a function of the input ranges. Works now for numeric and date inputs. This is useful when making predictions. It allows you to limit the domain that your prediction will be used and scored within.", ~examples=[ `declareFn({ @@ -47,7 +48,6 @@ let library = [ ~isExperimental=true, ~definitions=[ FnDefinition.make( - ~requiresNamespace=true, ~name="declare", ~inputs=[Declaration.frType], ~run=(_, inputs, _) => { diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_List.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_List.res index 9c064966..25924232 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_List.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_List.res @@ -29,12 +29,12 @@ let library = [ Function.make( ~name="make", ~nameSpace, + ~requiresNamespace, ~output=EvtArray, ~examples=[`List.make(2, "testValue")`], ~definitions=[ //Todo: If the second item is a function with no args, it could be nice to run this function and return the result. FnDefinition.make( - ~requiresNamespace, ~name="make", ~inputs=[FRTypeNumber, FRTypeAny], ~run=(inputs, _, _) => { @@ -51,11 +51,11 @@ let library = [ Function.make( ~name="upTo", ~nameSpace, + ~requiresNamespace, ~output=EvtArray, ~examples=[`List.upTo(1,4)`], ~definitions=[ FnDefinition.make( - ~requiresNamespace, ~name="upTo", ~inputs=[FRTypeNumber, FRTypeNumber], ~run=(_, inputs, _) => @@ -70,10 +70,10 @@ let library = [ Function.make( ~name="first", ~nameSpace, + ~requiresNamespace, ~examples=[`List.first([1,4,5])`], ~definitions=[ FnDefinition.make( - ~requiresNamespace, ~name="first", ~inputs=[FRTypeArray(FRTypeAny)], ~run=(inputs, _, _) => @@ -89,10 +89,10 @@ let library = [ Function.make( ~name="last", ~nameSpace, + ~requiresNamespace, ~examples=[`List.last([1,4,5])`], ~definitions=[ FnDefinition.make( - ~requiresNamespace=false, ~name="last", ~inputs=[FRTypeArray(FRTypeAny)], ~run=(inputs, _, _) => @@ -109,10 +109,10 @@ let library = [ ~name="reverse", ~nameSpace, ~output=EvtArray, + ~requiresNamespace=false, ~examples=[`List.reverse([1,4,5])`], ~definitions=[ FnDefinition.make( - ~requiresNamespace=false, ~name="reverse", ~inputs=[FRTypeArray(FRTypeAny)], ~run=(inputs, _, _) => diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Number.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Number.res index 0dba4c9a..10d5d1f2 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Number.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Number.res @@ -7,7 +7,6 @@ let requiresNamespace = false module NumberToNumber = { let make = (name, fn) => FnDefinition.make( - ~requiresNamespace, ~name, ~inputs=[FRTypeNumber], ~run=(_, inputs, _) => { @@ -24,7 +23,6 @@ module NumberToNumber = { module ArrayNumberDist = { let make = (name, fn) => { FnDefinition.make( - ~requiresNamespace=false, ~name, ~inputs=[FRTypeArray(FRTypeNumber)], ~run=(_, inputs, _) => @@ -51,6 +49,7 @@ let library = [ Function.make( ~name="floor", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`floor(3.5)`], ~definitions=[NumberToNumber.make("floor", Js.Math.floor_float)], @@ -59,6 +58,7 @@ let library = [ Function.make( ~name="ceiling", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`ceiling(3.5)`], ~definitions=[NumberToNumber.make("ceil", Js.Math.ceil_float)], @@ -67,6 +67,7 @@ let library = [ Function.make( ~name="absolute value", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`abs(3.5)`], ~definitions=[NumberToNumber.make("abs", Js.Math.abs_float)], @@ -75,6 +76,7 @@ let library = [ Function.make( ~name="exponent", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`exp(3.5)`], ~definitions=[NumberToNumber.make("exp", Js.Math.exp)], @@ -83,6 +85,7 @@ let library = [ Function.make( ~name="log", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`log(3.5)`], ~definitions=[NumberToNumber.make("log", Js.Math.log)], @@ -91,6 +94,7 @@ let library = [ Function.make( ~name="log base 10", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`log10(3.5)`], ~definitions=[NumberToNumber.make("log10", Js.Math.log10)], @@ -99,6 +103,7 @@ let library = [ Function.make( ~name="log base 2", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`log2(3.5)`], ~definitions=[NumberToNumber.make("log2", Js.Math.log2)], @@ -107,6 +112,7 @@ let library = [ Function.make( ~name="round", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`round(3.5)`], ~definitions=[NumberToNumber.make("round", Js.Math.round)], @@ -115,6 +121,7 @@ let library = [ Function.make( ~name="sum", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`sum([3,5,2])`], ~definitions=[ArrayNumberDist.make("sum", r => r->E.A.Floats.sum->Wrappers.evNumber->Ok)], @@ -123,6 +130,7 @@ let library = [ Function.make( ~name="product", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`product([3,5,2])`], ~definitions=[ @@ -133,6 +141,7 @@ let library = [ Function.make( ~name="min", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`min([3,5,2])`], ~definitions=[ArrayNumberDist.make("min", r => r->E.A.Floats.min->Wrappers.evNumber->Ok)], @@ -141,6 +150,7 @@ let library = [ Function.make( ~name="max", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`max([3,5,2])`], ~definitions=[ArrayNumberDist.make("max", r => r->E.A.Floats.max->Wrappers.evNumber->Ok)], @@ -149,6 +159,7 @@ let library = [ Function.make( ~name="mean", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`mean([3,5,2])`], ~definitions=[ArrayNumberDist.make("mean", r => r->E.A.Floats.mean->Wrappers.evNumber->Ok)], @@ -157,6 +168,7 @@ let library = [ Function.make( ~name="geometric mean", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`geomean([3,5,2])`], ~definitions=[ @@ -167,6 +179,7 @@ let library = [ Function.make( ~name="standard deviation", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`stdev([3,5,2,3,5])`], ~definitions=[ArrayNumberDist.make("stdev", r => r->E.A.Floats.stdev->Wrappers.evNumber->Ok)], @@ -175,6 +188,7 @@ let library = [ Function.make( ~name="variance", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[`variance([3,5,2,3,5])`], ~definitions=[ @@ -185,6 +199,7 @@ let library = [ Function.make( ~name="sort", ~nameSpace, + ~requiresNamespace, ~output=EvtArray, ~examples=[`sort([3,5,2,3,5])`], ~definitions=[ @@ -197,6 +212,7 @@ let library = [ Function.make( ~name="cumulative sum", ~nameSpace, + ~requiresNamespace, ~output=EvtArray, ~examples=[`cumsum([3,5,2,3,5])`], ~definitions=[ @@ -209,6 +225,7 @@ let library = [ Function.make( ~name="cumulative prod", ~nameSpace, + ~requiresNamespace, ~output=EvtArray, ~examples=[`cumprod([3,5,2,3,5])`], ~definitions=[ @@ -221,6 +238,7 @@ let library = [ Function.make( ~name="diff", ~nameSpace, + ~requiresNamespace, ~output=EvtArray, ~examples=[`diff([3,5,2,3,5])`], ~definitions=[ diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Pointset.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Pointset.res index 92e4ab5f..9a0745c1 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Pointset.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Pointset.res @@ -27,9 +27,9 @@ let library = [ Function.make( ~name="makeContinuous", ~nameSpace, + ~requiresNamespace, ~definitions=[ FnDefinition.make( - ~requiresNamespace, ~name="makeContinuous", ~inputs=[FRTypeArray(FRTypeRecord([("x", FRTypeNumeric), ("y", FRTypeNumeric)]))], ~run=(_, inputs, _) => inputsTodist(inputs, r => Continuous(Continuous.make(r))), @@ -41,9 +41,9 @@ let library = [ Function.make( ~name="makeDiscrete", ~nameSpace, + ~requiresNamespace, ~definitions=[ FnDefinition.make( - ~requiresNamespace, ~name="makeDiscrete", ~inputs=[FRTypeArray(FRTypeRecord([("x", FRTypeNumeric), ("y", FRTypeNumeric)]))], ~run=(_, inputs, _) => inputsTodist(inputs, r => Discrete(Discrete.make(r))), diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Scoring.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Scoring.res index 19886841..0ba1f5c3 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Scoring.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/Library/FR_Scoring.res @@ -1,7 +1,7 @@ open FunctionRegistry_Core let nameSpace = "Dist" -let requiresNamespace = false +let requiresNamespace = true let runScoring = (estimate, answer, prior, env) => { GenericDist.Score.logScore(~estimate, ~answer, ~prior, ~env) @@ -13,6 +13,7 @@ let library = [ Function.make( ~name="logScore", ~nameSpace, + ~requiresNamespace, ~output=EvtNumber, ~examples=[ "Dist.logScore({estimate: normal(5,2), answer: normal(5.2,1)}, prior: normal(5.5,3)})", @@ -21,7 +22,6 @@ let library = [ ], ~definitions=[ FnDefinition.make( - ~requiresNamespace, ~name="logScore", ~inputs=[ FRTypeRecord([ @@ -48,7 +48,6 @@ let library = [ ), FnDefinition.make( ~name="logScore", - ~requiresNamespace, ~inputs=[FRTypeRecord([("estimate", FRTypeDist), ("answer", FRTypeDistOrNumber)])], ~run=(_, inputs, env) => { switch FunctionRegistry_Helpers.Prepare.ToValueArray.Record.twoArgs(inputs) { @@ -69,11 +68,11 @@ let library = [ ~name="klDivergence", ~nameSpace, ~output=EvtNumber, + ~requiresNamespace, ~examples=["Dist.klDivergence(normal(5,2), normal(5,1.5)"], ~definitions=[ FnDefinition.make( ~name="klDivergence", - ~requiresNamespace, ~inputs=[FRTypeDist, FRTypeDist], ~run=(_, inputs, env) => { switch inputs { diff --git a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_ExternalLibrary.res b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_ExternalLibrary.res index 3e6172c9..c9b72b69 100644 --- a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_ExternalLibrary.res +++ b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_ExternalLibrary.res @@ -18,9 +18,12 @@ type internalExpressionValue = InternalExpressionValue.t let registry = FunctionRegistry_Library.registry let tryRegistry = ((fnName, args): InternalExpressionValue.functionCall, env) => { - FunctionRegistry_Core.Registry.matchAndRun(~registry, ~fnName, ~args, ~env)->E.O2.fmap( - E.R2.errMap(_, s => Reducer_ErrorValue.RETodo(s)), - ) + FunctionRegistry_Core.Registry.matchAndRun( + ~registry=FunctionRegistry_Core.Registry.exportedSubset(registry), + ~fnName, + ~args, + ~env, + )->E.O2.fmap(E.R2.errMap(_, s => Reducer_ErrorValue.RETodo(s))) } let dispatch = (call: InternalExpressionValue.functionCall, environment, chain): result<