cleanups; ReducerInterface is no more
This commit is contained in:
parent
7a0c10d895
commit
b24cfbc328
|
@ -1,9 +0,0 @@
|
|||
// Reducer_Helpers
|
||||
module ErrorValue = Reducer_ErrorValue
|
||||
module InternalExpressionValue = ReducerInterface.InternalExpressionValue
|
||||
|
||||
let removeDefaultsInternal = (iev: InternalExpressionValue.t) => {
|
||||
iev // TODO - cleanup, noop
|
||||
}
|
||||
|
||||
let rRemoveDefaultsInternal = r => Belt.Result.map(r, removeDefaultsInternal)
|
|
@ -1,6 +1,5 @@
|
|||
module Expression = Reducer_Expression
|
||||
module ExpressionT = Reducer_Expression_T
|
||||
module ExpressionValue = ReducerInterface.InternalExpressionValue
|
||||
module Parse = Reducer_Peggy_Parse
|
||||
module Result = Belt.Result
|
||||
module ToExpression = Reducer_Peggy_ToExpression
|
||||
|
@ -24,8 +23,7 @@ let expectToExpressionToBe = (expr, answer, ~v="_", ()) => {
|
|||
let a2 =
|
||||
rExpr
|
||||
->Result.flatMap(expr => Expression.BackCompatible.evaluate(expr))
|
||||
->Reducer_Helpers.rRemoveDefaultsInternal
|
||||
->ExpressionValue.toStringResultOkless
|
||||
->Reducer_Value.toStringResultOkless
|
||||
(a1, a2)->expect->toEqual((answer, v))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
module Bindings = Reducer_Bindings
|
||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
|
||||
open Jest
|
||||
open Reducer_Peggy_TestHelpers
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
module Bindings = Reducer_Bindings
|
||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
|
||||
open Jest
|
||||
open Reducer_Peggy_TestHelpers
|
||||
|
@ -144,9 +143,9 @@ describe("Peggy to Expression", () => {
|
|||
describe("module", () => {
|
||||
// testToExpression("Math.pi", "{:Math.pi}", ~v="3.141592653589793", ())
|
||||
// Only.test("stdlibrary", () => {
|
||||
// ReducerInterface_StdLib.internalStdLib
|
||||
// SquiggleLibrary_StdLib.stdLib
|
||||
// ->IEvBindings
|
||||
// ->InternalExpressionValue.toString
|
||||
// ->Reducer_Value.toString
|
||||
// ->expect
|
||||
// ->toBe("")
|
||||
// })
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module ErrorValue = Reducer_ErrorValue
|
||||
module Expression = Reducer_Expression
|
||||
module ExpressionT = Reducer_Expression_T
|
||||
module InternalExpressionValue = ReducerInterface.InternalExpressionValue
|
||||
|
||||
open Jest
|
||||
open Expect
|
||||
|
@ -19,14 +18,13 @@ let expectParseToBe = (code: string, answer: string) =>
|
|||
|
||||
let expectEvalToBe = (code: string, answer: string) =>
|
||||
Expression.BackCompatible.evaluateString(code)
|
||||
->Reducer_Helpers.rRemoveDefaultsInternal
|
||||
->InternalExpressionValue.toStringResult
|
||||
->Reducer_Value.toStringResult
|
||||
->expect
|
||||
->toBe(answer)
|
||||
|
||||
let expectEvalError = (code: string) =>
|
||||
Expression.BackCompatible.evaluateString(code)
|
||||
->InternalExpressionValue.toStringResult
|
||||
->Reducer_Value.toStringResult
|
||||
->expect
|
||||
->toMatch("Error\(")
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// module Expression = Reducer_Expression
|
||||
// module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
// module Bindings = Reducer_Bindings
|
||||
// module T = Reducer_Type_T
|
||||
// module TypeCompile = Reducer_Type_Compile
|
||||
|
@ -10,7 +9,7 @@
|
|||
// let myIevEval = (aTypeSourceCode: string) =>
|
||||
// TypeCompile.ievFromTypeExpression(aTypeSourceCode, Expression.reduceExpressionInProject)
|
||||
// let myIevEvalToString = (aTypeSourceCode: string) =>
|
||||
// myIevEval(aTypeSourceCode)->InternalExpressionValue.toStringResult
|
||||
// myIevEval(aTypeSourceCode)->Reducer_Value.toStringResult
|
||||
|
||||
// let myIevExpectEqual = (aTypeSourceCode, answer) =>
|
||||
// expect(myIevEvalToString(aTypeSourceCode))->toEqual(answer)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// module Bindings = Reducer_Bindings
|
||||
// module ErrorValue = Reducer_ErrorValue
|
||||
// module Expression = Reducer_Expression
|
||||
// module ExpressionT = Reducer_Expression_T
|
||||
// module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
// module ProjectAccessorsT = ReducerProject_ProjectAccessors_T
|
||||
// module T = Reducer_Type_T
|
||||
// module TypeChecker = Reducer_Type_TypeChecker
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
// module Expression = Reducer_Expression
|
||||
// module ExpressionT = Reducer_Expression_T
|
||||
// module ErrorValue = Reducer_ErrorValue
|
||||
// module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
// module Bindings = Reducer_Bindings
|
||||
// module T = Reducer_Type_T
|
||||
// module TypeChecker = Reducer_Type_TypeChecker
|
||||
|
|
|
@ -8,15 +8,13 @@
|
|||
// module TypeChecker = Reducer_Type_TypeChecker
|
||||
// module TypeCompile = Reducer_Type_Compile
|
||||
|
||||
// open ReducerInterface_InternalExpressionValue
|
||||
|
||||
// type errorValue = Reducer_ErrorValue.errorValue
|
||||
|
||||
// // Let's build a function to replace switch statements
|
||||
// // In dispatchChainPiece, we execute an return the result of execution if there is a type match.
|
||||
// // Otherwise we return None so that the call chain can continue.
|
||||
// // So we want to build a function like
|
||||
// // dispatchChainPiece = (call: functionCall, accessors): option<result<internalExpressionValue, errorValue>>
|
||||
// // dispatchChainPiece = (call: functionCall, accessors): option<result<Reducer_T.value, errorValue>>
|
||||
// // Use accessors.environment to get the environment finally.
|
||||
|
||||
// // Now lets make the dispatchChainPiece itself.
|
||||
|
@ -28,9 +26,9 @@
|
|||
// module Implementation = {
|
||||
// let stringConcat = (a: string, b: string): string => Js.String2.concat(a, b)
|
||||
// let arrayConcat = (
|
||||
// a: Js.Array2.t<internalExpressionValue>,
|
||||
// b: Js.Array2.t<internalExpressionValue>,
|
||||
// ): Js.Array2.t<internalExpressionValue> => Js.Array2.concat(a, b)
|
||||
// a: Js.Array2.t<Reducer_T.value>,
|
||||
// b: Js.Array2.t<Reducer_T.value>,
|
||||
// ): Js.Array2.t<Reducer_T.value> => Js.Array2.concat(a, b)
|
||||
// let plot = _r => "yey, plotted"
|
||||
// }
|
||||
|
||||
|
@ -104,7 +102,7 @@
|
|||
// accessors: ProjectAccessorsT.t,
|
||||
// reducer: Reducer_T.reducerFn,
|
||||
// chain,
|
||||
// ): result<internalExpressionValue, 'e> => {
|
||||
// ): result<Reducer_T.value, 'e> => {
|
||||
// let dispatchChainPiece = makeMyDispatchChainPiece(reducer)
|
||||
// dispatchChainPiece(call, accessors)->E.O2.defaultFn(() => chain(call, accessors, reducer))
|
||||
// }
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
open ReducerInterface.InternalExpressionValue
|
||||
open Jest
|
||||
open Expect
|
||||
|
||||
describe("ExpressionValue", () => {
|
||||
test("argsToString", () => expect([IEvNumber(1.), IEvString("a")]->argsToString)->toBe("1,'a'"))
|
||||
test("argsToString", () => expect(
|
||||
[IEvNumber(1.), IEvString("a")]->Reducer_Value.argsToString)->toBe("1,'a'")
|
||||
)
|
||||
|
||||
test("toStringFunctionCall", () =>
|
||||
expect(("fn", [IEvNumber(1.), IEvString("a")])->toStringFunctionCall)->toBe("fn(1,'a')")
|
||||
expect(
|
||||
("fn", [IEvNumber(1.), IEvString("a")])->Reducer_Value.toStringFunctionCall)->toBe("fn(1,'a')"
|
||||
)
|
||||
)
|
||||
})
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
@@warning("-44")
|
||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
module Project = ForTS_ReducerProject
|
||||
module Bindings = Reducer_Bindings
|
||||
|
||||
open Jest
|
||||
open Expect
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
@@warning("-44")
|
||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
module Project = ForTS_ReducerProject
|
||||
module Bindings = Reducer_Bindings
|
||||
|
||||
|
@ -9,12 +8,12 @@ open Expect.Operators
|
|||
|
||||
let runFetchResult = (project, sourceId) => {
|
||||
Project.run(project, sourceId)
|
||||
Project.getResult(project, sourceId)->InternalExpressionValue.toStringResult
|
||||
Project.getResult(project, sourceId)->Reducer_Value.toStringResult
|
||||
}
|
||||
|
||||
let runFetchFlatBindings = (project, sourceId) => {
|
||||
Project.run(project, sourceId)
|
||||
Project.getBindings(project, sourceId)->InternalExpressionValue.toStringRecord
|
||||
Project.getBindings(project, sourceId)->Reducer_Value.toStringRecord
|
||||
}
|
||||
|
||||
test("test result true", () => {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
@@warning("-44")
|
||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
module Project = ForTS_ReducerProject
|
||||
module Bindings = Reducer_Bindings
|
||||
|
||||
|
@ -50,8 +49,8 @@ Case "Running a single source".
|
|||
|
||||
/* Let's display the result and bindings */
|
||||
(
|
||||
result->InternalExpressionValue.toStringResult,
|
||||
bindings->InternalExpressionValue.toStringRecord,
|
||||
result->Reducer_Value.toStringResult,
|
||||
bindings->Reducer_Value.toStringRecord,
|
||||
)->expect == ("Ok(3)", "{}")
|
||||
/* You've got 3 with empty bindings. */
|
||||
})
|
||||
|
@ -64,8 +63,8 @@ Case "Running a single source".
|
|||
let bindings = project->Project.getBindings("main")
|
||||
/* Now you have external bindings and external result. */
|
||||
(
|
||||
result->InternalExpressionValue.toStringResult,
|
||||
bindings->Reducer_T.IEvRecord->InternalExpressionValue.toString,
|
||||
result->Reducer_Value.toStringResult,
|
||||
bindings->Reducer_T.IEvRecord->Reducer_Value.toString,
|
||||
)->expect == ("Ok(3)", "{}")
|
||||
})
|
||||
|
||||
|
@ -74,13 +73,13 @@ Case "Running a single source".
|
|||
let project = Project.createProject()
|
||||
|
||||
/* Optional. Set your custom environment anytime before running */
|
||||
project->Project.setEnvironment(InternalExpressionValue.defaultEnvironment)
|
||||
project->Project.setEnvironment(Reducer_Context.defaultEnvironment)
|
||||
|
||||
project->Project.setSource("main", "1 + 2")
|
||||
project->Project.runAll
|
||||
let result = project->Project.getResult("main")
|
||||
let _bindings = project->Project.getBindings("main")
|
||||
result->InternalExpressionValue.toStringResult->expect == "Ok(3)"
|
||||
result->Reducer_Value.toStringResult->expect == "Ok(3)"
|
||||
})
|
||||
|
||||
test("shortcut", () => {
|
||||
|
@ -88,8 +87,8 @@ Case "Running a single source".
|
|||
/* Examples above was to prepare you for the multi source tutorial. */
|
||||
let (result, bindings) = Project.evaluate("1+2")
|
||||
(
|
||||
result->InternalExpressionValue.toStringResult,
|
||||
bindings->InternalExpressionValue.toStringRecord,
|
||||
result->Reducer_Value.toStringResult,
|
||||
bindings->Reducer_Value.toStringRecord,
|
||||
)->expect == ("Ok(3)", "{}")
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
@@warning("-44")
|
||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
module Project = ForTS_ReducerProject
|
||||
module Bindings = Reducer_Bindings
|
||||
|
||||
|
@ -32,8 +31,8 @@ describe("ReducerProject Tutorial", () => {
|
|||
let bindings3 = project->Project.getBindings("source3")
|
||||
|
||||
(
|
||||
result3->InternalExpressionValue.toStringResult,
|
||||
bindings3->InternalExpressionValue.toStringRecord,
|
||||
result3->Reducer_Value.toStringResult,
|
||||
bindings3->Reducer_Value.toStringRecord,
|
||||
)->expect == ("Ok(())", "{z: 3}")
|
||||
})
|
||||
|
||||
|
@ -58,8 +57,8 @@ describe("ReducerProject Tutorial", () => {
|
|||
let bindings3 = project->Project.getBindings("source3")
|
||||
|
||||
(
|
||||
result3->InternalExpressionValue.toStringResult,
|
||||
bindings3->InternalExpressionValue.toStringRecord,
|
||||
result3->Reducer_Value.toStringResult,
|
||||
bindings3->Reducer_Value.toStringRecord,
|
||||
)->expect == ("Ok(())", "{z: 3}")
|
||||
})
|
||||
|
||||
|
@ -93,8 +92,8 @@ describe("ReducerProject Tutorial", () => {
|
|||
let bindings3 = project->Project.getBindings("source3")
|
||||
|
||||
(
|
||||
result3->InternalExpressionValue.toStringResult,
|
||||
bindings3->InternalExpressionValue.toStringRecord,
|
||||
result3->Reducer_Value.toStringResult,
|
||||
bindings3->Reducer_Value.toStringRecord,
|
||||
)->expect == ("Ok(())", "{z: 3}")
|
||||
/*
|
||||
Doing it like this is too verbose for a storybook
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
@@warning("-44")
|
||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
module Project = ForTS_ReducerProject
|
||||
module Bindings = Reducer_Bindings
|
||||
|
||||
|
@ -146,8 +145,8 @@ Here we will finally proceed to a real life scenario. */
|
|||
/* And see the result and bindings.. */
|
||||
test("recursive includes", () => {
|
||||
(
|
||||
result->InternalExpressionValue.toStringResult,
|
||||
bindings->InternalExpressionValue.toStringRecord,
|
||||
result->Reducer_Value.toStringResult,
|
||||
bindings->Reducer_Value.toStringRecord,
|
||||
)->expect == ("Ok(6)", "{a: 6,b: 2}")
|
||||
/* Everything as expected */
|
||||
})
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
@@warning("-44")
|
||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
module Project = ForTS_ReducerProject
|
||||
module Bindings = Reducer_Bindings
|
||||
|
||||
open Jest
|
||||
open Expect
|
||||
|
@ -30,7 +28,7 @@ describe("ReducerProject Tutorial", () => {
|
|||
/* We can now run the project */
|
||||
Project.runAll(project)
|
||||
let result = Project.getResult(project, "main")
|
||||
result->InternalExpressionValue.toStringResult->expect == "Ok(6)"
|
||||
result->Reducer_Value.toStringResult->expect == "Ok(6)"
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
@@warning("-44")
|
||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
module Project = ForTS_ReducerProject
|
||||
module Bindings = Reducer_Bindings
|
||||
|
||||
|
@ -32,7 +31,7 @@ describe("ReducerProject Tutorial", () => {
|
|||
|
||||
test("userResults", () => {
|
||||
let userResultsAsString = Belt.Array.map(userResults, aResult =>
|
||||
aResult->InternalExpressionValue.toStringResult
|
||||
aResult->Reducer_Value.toStringResult
|
||||
)
|
||||
userResultsAsString->expect == ["Ok(2)", "Ok(4)", "Ok(6)", "Ok(8)", "Ok(10)"]
|
||||
})
|
||||
|
|
|
@ -4,7 +4,6 @@ open Reducer_TestHelpers
|
|||
|
||||
let expectEvalToBeOk = (code: string) =>
|
||||
Reducer_Expression.BackCompatible.evaluateString(code)
|
||||
->Reducer_Helpers.rRemoveDefaultsInternal
|
||||
->E.R.isOk
|
||||
->expect
|
||||
->toBe(true)
|
||||
|
@ -102,7 +101,7 @@ describe("FunctionRegistry Library", () => {
|
|||
let responseType =
|
||||
example
|
||||
->Reducer_Expression.BackCompatible.evaluateString
|
||||
->E.R2.fmap(ReducerInterface_InternalExpressionValue.valueToValueType)
|
||||
->E.R2.fmap(Reducer_Value.valueToValueType)
|
||||
let expectedOutputType = fn.output |> E.O.toExn("")
|
||||
expect(responseType)->toEqual(Ok(expectedOutputType))
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ let nameSpace = "" // no namespaced versions
|
|||
|
||||
type simpleDefinition = {
|
||||
inputs: array<frType>,
|
||||
fn: array<internalExpressionValue> => result<internalExpressionValue, errorValue>,
|
||||
fn: array<Reducer_T.value> => result<Reducer_T.value, errorValue>,
|
||||
}
|
||||
|
||||
let makeFnMany = (name: string, definitions: array<simpleDefinition>) =>
|
||||
|
@ -22,7 +22,7 @@ let makeFnMany = (name: string, definitions: array<simpleDefinition>) =>
|
|||
let makeFn = (
|
||||
name: string,
|
||||
inputs: array<frType>,
|
||||
fn: array<internalExpressionValue> => result<internalExpressionValue, errorValue>,
|
||||
fn: array<Reducer_T.value> => result<Reducer_T.value, errorValue>,
|
||||
) => makeFnMany(name, [{inputs: inputs, fn: fn}])
|
||||
|
||||
let library = [
|
||||
|
@ -140,7 +140,7 @@ let library = [
|
|||
makeFn("inspect", [FRTypeAny], inputs => {
|
||||
switch inputs {
|
||||
| [value] => {
|
||||
Js.log(value->ReducerInterface_InternalExpressionValue.toString)
|
||||
Js.log(value->Reducer_Value.toString)
|
||||
value->Ok
|
||||
}
|
||||
| _ => Error(impossibleError)
|
||||
|
@ -149,7 +149,7 @@ let library = [
|
|||
makeFn("inspect", [FRTypeAny, FRTypeString], inputs => {
|
||||
switch inputs {
|
||||
| [value, IEvString(label)] => {
|
||||
Js.log(`${label}: ${value->ReducerInterface_InternalExpressionValue.toString}`)
|
||||
Js.log(`${label}: ${value->Reducer_Value.toString}`)
|
||||
value->Ok
|
||||
}
|
||||
| _ => Error(impossibleError)
|
||||
|
@ -158,7 +158,7 @@ let library = [
|
|||
makeFn("javascriptraise", [FRTypeAny], inputs => {
|
||||
switch inputs {
|
||||
| [msg] => {
|
||||
Js.Exn.raiseError(msg->ReducerInterface_InternalExpressionValue.toString)
|
||||
Js.Exn.raiseError(msg->Reducer_Value.toString)
|
||||
}
|
||||
| _ => Error(impossibleError)
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ open FunctionRegistry_Helpers
|
|||
let makeFn = (
|
||||
name: string,
|
||||
inputs: array<frType>,
|
||||
fn: array<internalExpressionValue> => result<internalExpressionValue, errorValue>,
|
||||
fn: array<Reducer_T.value> => result<Reducer_T.value, errorValue>,
|
||||
) =>
|
||||
Function.make(
|
||||
~name,
|
||||
|
|
|
@ -6,24 +6,24 @@ let nameSpace = "Dict"
|
|||
module Internals = {
|
||||
type t = Reducer_T.map
|
||||
|
||||
let keys = (a: t): internalExpressionValue => IEvArray(
|
||||
let keys = (a: t): Reducer_T.value => IEvArray(
|
||||
Belt.Map.String.keysToArray(a)->E.A2.fmap(Wrappers.evString),
|
||||
)
|
||||
|
||||
let values = (a: t): internalExpressionValue => IEvArray(Belt.Map.String.valuesToArray(a))
|
||||
let values = (a: t): Reducer_T.value => IEvArray(Belt.Map.String.valuesToArray(a))
|
||||
|
||||
let toList = (a: t): internalExpressionValue =>
|
||||
let toList = (a: t): Reducer_T.value =>
|
||||
Belt.Map.String.toArray(a)
|
||||
->E.A2.fmap(((key, value)) => Wrappers.evArray([IEvString(key), value]))
|
||||
->Wrappers.evArray
|
||||
|
||||
let fromList = (items: array<internalExpressionValue>): result<
|
||||
internalExpressionValue,
|
||||
let fromList = (items: array<Reducer_T.value>): result<
|
||||
Reducer_T.value,
|
||||
errorValue,
|
||||
> =>
|
||||
items
|
||||
->E.A2.fmap(item => {
|
||||
switch (item: internalExpressionValue) {
|
||||
switch (item: Reducer_T.value) {
|
||||
| IEvArray([IEvString(string), value]) => (string, value)->Ok
|
||||
| _ => Error(impossibleError)
|
||||
}
|
||||
|
@ -32,12 +32,12 @@ module Internals = {
|
|||
->E.R2.fmap(Belt.Map.String.fromArray)
|
||||
->E.R2.fmap(Wrappers.evRecord)
|
||||
|
||||
let merge = (a: t, b: t): internalExpressionValue => IEvRecord(
|
||||
let merge = (a: t, b: t): Reducer_T.value => IEvRecord(
|
||||
Belt.Map.String.merge(a, b, (_, _, c) => c),
|
||||
)
|
||||
|
||||
//Belt.Map.String has a function for mergeMany, but I couldn't understand how to use it yet.
|
||||
let mergeMany = (a: array<t>): internalExpressionValue => {
|
||||
let mergeMany = (a: array<t>): Reducer_T.value => {
|
||||
let mergedValues =
|
||||
a->E.A2.fmap(Belt.Map.String.toArray)->Belt.Array.concatMany->Belt.Map.String.fromArray
|
||||
IEvRecord(mergedValues)
|
||||
|
|
|
@ -4,7 +4,7 @@ let twoArgs = E.Tuple2.toFnCall
|
|||
|
||||
module DistributionCreation = {
|
||||
let nameSpace = "Dist"
|
||||
let output = ReducerInterface_InternalExpressionValue.EvtDistribution
|
||||
let output = Reducer_Value.EvtDistribution
|
||||
let requiresNamespace = false
|
||||
|
||||
let fnMake = (~name, ~examples, ~definitions) => {
|
||||
|
|
|
@ -7,7 +7,7 @@ module Declaration = {
|
|||
("inputs", FRTypeArray(FRTypeRecord([("min", FRTypeNumber), ("max", FRTypeNumber)]))),
|
||||
])
|
||||
|
||||
let fromExpressionValue = (e: frValue): result<internalExpressionValue, string> => {
|
||||
let fromExpressionValue = (e: frValue): result<Reducer_T.value, string> => {
|
||||
switch FunctionRegistry_Helpers.Prepare.ToValueArray.Record.twoArgs([e]) {
|
||||
| Ok([FRValueLambda(lambda), FRValueArray(inputs)]) => {
|
||||
open FunctionRegistry_Helpers.Prepare
|
||||
|
|
|
@ -18,7 +18,7 @@ module Old = {
|
|||
| _ => #Multiply
|
||||
}
|
||||
|
||||
let catchAndConvertTwoArgsToDists = (args: array<internalExpressionValue>): option<(
|
||||
let catchAndConvertTwoArgsToDists = (args: array<Reducer_T.value>): option<(
|
||||
DistributionTypes.genericDist,
|
||||
DistributionTypes.genericDist,
|
||||
)> =>
|
||||
|
@ -68,18 +68,18 @@ module Old = {
|
|||
)->DistributionOperation.run(~env)
|
||||
}
|
||||
|
||||
let parseNumber = (args: internalExpressionValue): Belt.Result.t<float, string> =>
|
||||
let parseNumber = (args: Reducer_T.value): Belt.Result.t<float, string> =>
|
||||
switch args {
|
||||
| IEvNumber(x) => Ok(x)
|
||||
| _ => Error("Not a number")
|
||||
}
|
||||
|
||||
let parseNumberArray = (ags: array<internalExpressionValue>): Belt.Result.t<
|
||||
let parseNumberArray = (ags: array<Reducer_T.value>): Belt.Result.t<
|
||||
array<float>,
|
||||
string,
|
||||
> => E.A.fmap(parseNumber, ags) |> E.A.R.firstErrorOrOpen
|
||||
|
||||
let parseDist = (args: internalExpressionValue): Belt.Result.t<
|
||||
let parseDist = (args: Reducer_T.value): Belt.Result.t<
|
||||
DistributionTypes.genericDist,
|
||||
string,
|
||||
> =>
|
||||
|
@ -89,7 +89,7 @@ module Old = {
|
|||
| _ => Error("Not a distribution")
|
||||
}
|
||||
|
||||
let parseDistributionArray = (ags: array<internalExpressionValue>): Belt.Result.t<
|
||||
let parseDistributionArray = (ags: array<Reducer_T.value>): Belt.Result.t<
|
||||
array<DistributionTypes.genericDist>,
|
||||
string,
|
||||
> => E.A.fmap(parseDist, ags) |> E.A.R.firstErrorOrOpen
|
||||
|
@ -115,7 +115,7 @@ module Old = {
|
|||
}
|
||||
|
||||
let mixture = (
|
||||
args: array<internalExpressionValue>,
|
||||
args: array<Reducer_T.value>,
|
||||
~env: GenericDist.env,
|
||||
): DistributionOperation.outputType => {
|
||||
let error = (err: string): DistributionOperation.outputType =>
|
||||
|
@ -174,7 +174,7 @@ module Old = {
|
|||
}
|
||||
|
||||
let dispatchToGenericOutput = (
|
||||
call: ReducerInterface_InternalExpressionValue.functionCall,
|
||||
call: Reducer_Value.functionCall,
|
||||
env: GenericDist.env,
|
||||
): option<DistributionOperation.outputType> => {
|
||||
let (fnName, args) = call
|
||||
|
@ -301,7 +301,7 @@ module Old = {
|
|||
}
|
||||
|
||||
let genericOutputToReducerValue = (o: DistributionOperation.outputType): result<
|
||||
internalExpressionValue,
|
||||
Reducer_T.value,
|
||||
Reducer_ErrorValue.errorValue,
|
||||
> =>
|
||||
switch o {
|
||||
|
@ -313,7 +313,7 @@ module Old = {
|
|||
| GenDistError(err) => Error(REDistributionError(err))
|
||||
}
|
||||
|
||||
let dispatch = (call: ReducerInterface_InternalExpressionValue.functionCall, environment) =>
|
||||
let dispatch = (call: Reducer_Value.functionCall, environment) =>
|
||||
switch dispatchToGenericOutput(call, environment) {
|
||||
| Some(o) => genericOutputToReducerValue(o)
|
||||
| None =>
|
||||
|
|
|
@ -7,29 +7,29 @@ let requiresNamespace = true
|
|||
module Internals = {
|
||||
let makeFromNumber = (
|
||||
n: float,
|
||||
value: internalExpressionValue,
|
||||
): internalExpressionValue => IEvArray(Belt.Array.make(E.Float.toInt(n), value))
|
||||
value: Reducer_T.value,
|
||||
): Reducer_T.value => IEvArray(Belt.Array.make(E.Float.toInt(n), value))
|
||||
|
||||
let upTo = (low: float, high: float): internalExpressionValue => IEvArray(
|
||||
let upTo = (low: float, high: float): Reducer_T.value => IEvArray(
|
||||
E.A.Floats.range(low, high, (high -. low +. 1.0)->E.Float.toInt)->E.A2.fmap(Wrappers.evNumber),
|
||||
)
|
||||
|
||||
let first = (v: array<internalExpressionValue>): result<internalExpressionValue, string> =>
|
||||
let first = (v: array<Reducer_T.value>): result<Reducer_T.value, string> =>
|
||||
v->E.A.first |> E.O.toResult("No first element")
|
||||
|
||||
let last = (v: array<internalExpressionValue>): result<internalExpressionValue, string> =>
|
||||
let last = (v: array<Reducer_T.value>): result<Reducer_T.value, string> =>
|
||||
v->E.A.last |> E.O.toResult("No last element")
|
||||
|
||||
let reverse = (array: array<internalExpressionValue>): internalExpressionValue => IEvArray(
|
||||
let reverse = (array: array<Reducer_T.value>): Reducer_T.value => IEvArray(
|
||||
Belt.Array.reverse(array),
|
||||
)
|
||||
|
||||
let map = (
|
||||
array: array<internalExpressionValue>,
|
||||
array: array<Reducer_T.value>,
|
||||
eLambdaValue,
|
||||
env: Reducer_T.environment,
|
||||
reducer: Reducer_T.reducerFn,
|
||||
): internalExpressionValue => {
|
||||
): Reducer_T.value => {
|
||||
Belt.Array.map(array, elem =>
|
||||
Reducer_Expression_Lambda.doLambdaCall(eLambdaValue, [elem], env, reducer)
|
||||
)->Wrappers.evArray
|
||||
|
|
|
@ -48,7 +48,7 @@ let library = [
|
|||
~nameSpace,
|
||||
~requiresNamespace=true,
|
||||
~examples=[`PointSet.fromDist(normal(5,2))`],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="fromDist",
|
||||
|
@ -77,7 +77,7 @@ let library = [
|
|||
~nameSpace,
|
||||
~requiresNamespace=true,
|
||||
~examples=[`PointSet.mapY(mx(normal(5,2)), {|x| x + 1})`],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="mapY",
|
||||
|
@ -105,7 +105,7 @@ let library = [
|
|||
{x: 3, y: 0.2}
|
||||
])`,
|
||||
],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="makeContinuous",
|
||||
|
@ -129,7 +129,7 @@ let library = [
|
|||
{x: 3, y: 0.2}
|
||||
])`,
|
||||
],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="makeDiscrete",
|
||||
|
|
|
@ -48,10 +48,10 @@ module Internal = {
|
|||
SampleSetDist.map3(~fn, ~t1, ~t2, ~t3)->toType
|
||||
}
|
||||
|
||||
let parseSampleSetArray = (arr: array<internalExpressionValue>): option<
|
||||
let parseSampleSetArray = (arr: array<Reducer_T.value>): option<
|
||||
array<SampleSetDist.t>,
|
||||
> => {
|
||||
let parseSampleSet = (value: internalExpressionValue): option<SampleSetDist.t> =>
|
||||
let parseSampleSet = (value: Reducer_T.value): option<SampleSetDist.t> =>
|
||||
switch value {
|
||||
| IEvDistribution(SampleSet(dist)) => Some(dist)
|
||||
| _ => None
|
||||
|
@ -60,7 +60,7 @@ module Internal = {
|
|||
}
|
||||
|
||||
let mapN = (
|
||||
aValueArray: array<internalExpressionValue>,
|
||||
aValueArray: array<Reducer_T.value>,
|
||||
aLambdaValue,
|
||||
environment: Reducer_T.environment,
|
||||
reducer,
|
||||
|
@ -86,7 +86,7 @@ let libaryBase = [
|
|||
~nameSpace,
|
||||
~requiresNamespace=true,
|
||||
~examples=[`SampleSet.fromDist(normal(5,2))`],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="fromDist",
|
||||
|
@ -110,7 +110,7 @@ let libaryBase = [
|
|||
~nameSpace,
|
||||
~requiresNamespace=true,
|
||||
~examples=[`SampleSet.fromList([3,5,2,3,5,2,3,5,2,3,3,5,3,2,3,1,1,3])`],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="fromList",
|
||||
|
@ -135,7 +135,7 @@ let libaryBase = [
|
|||
~nameSpace,
|
||||
~requiresNamespace=true,
|
||||
~examples=[`SampleSet.toList(SampleSet.fromDist(normal(5,2)))`],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtArray,
|
||||
~output=Reducer_Value.EvtArray,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="toList",
|
||||
|
@ -156,7 +156,7 @@ let libaryBase = [
|
|||
~nameSpace,
|
||||
~requiresNamespace=true,
|
||||
~examples=[`SampleSet.fromFn({|| sample(normal(5,2))})`],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="fromFn",
|
||||
|
@ -180,7 +180,7 @@ let libaryBase = [
|
|||
~nameSpace,
|
||||
~requiresNamespace,
|
||||
~examples=[`SampleSet.map(SampleSet.fromDist(normal(5,2)), {|x| x + 1})`],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="map",
|
||||
|
@ -203,7 +203,7 @@ let libaryBase = [
|
|||
~examples=[
|
||||
`SampleSet.map2(SampleSet.fromDist(normal(5,2)), SampleSet.fromDist(normal(5,2)), {|x, y| x + y})`,
|
||||
],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="map2",
|
||||
|
@ -231,7 +231,7 @@ let libaryBase = [
|
|||
~examples=[
|
||||
`SampleSet.map3(SampleSet.fromDist(normal(5,2)), SampleSet.fromDist(normal(5,2)), SampleSet.fromDist(normal(5,2)), {|x, y, z| max([x,y,z])})`,
|
||||
],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="map3",
|
||||
|
@ -259,7 +259,7 @@ let libaryBase = [
|
|||
~examples=[
|
||||
`SampleSet.mapN([SampleSet.fromDist(normal(5,2)), SampleSet.fromDist(normal(5,2)), SampleSet.fromDist(normal(5,2))], {|x| max(x)})`,
|
||||
],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
FnDefinition.make(
|
||||
~name="mapN",
|
||||
|
@ -306,7 +306,7 @@ module Comparison = {
|
|||
`SampleSet.${name}(SampleSet.fromDist(normal(5,2)), 3.0)`,
|
||||
`SampleSet.${name}(4.0, SampleSet.fromDist(normal(6,2)))`,
|
||||
],
|
||||
~output=ReducerInterface_InternalExpressionValue.EvtDistribution,
|
||||
~output=Reducer_Value.EvtDistribution,
|
||||
~definitions=[
|
||||
template(name, [FRTypeDist, FRTypeDist], inputs => {
|
||||
switch inputs {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
type environment = ForTS_Distribution_Environment.environment //use
|
||||
|
||||
@genType
|
||||
let defaultEnvironment: environment = DistributionOperation.defaultEnv
|
||||
let defaultEnvironment: environment = Reducer_Context.defaultEnvironment
|
||||
|
||||
@module("./ForTS_Distribution_tag") @scope("distributionTag")
|
||||
external dtPointSet_: string = "PointSet"
|
||||
|
|
|
@ -74,13 +74,13 @@ let getTag = (variant: squiggleValue): squiggleValueTag =>
|
|||
|
||||
@genType
|
||||
let toString = (variant: squiggleValue) =>
|
||||
ReducerInterface_InternalExpressionValue.toString(variant)
|
||||
Reducer_Value.toString(variant)
|
||||
|
||||
// This is a useful method for unit tests.
|
||||
// Convert the result along with the error message to a string.
|
||||
@genType
|
||||
let toStringResult = (variantResult: result<squiggleValue, reducerErrorValue>) =>
|
||||
ReducerInterface_InternalExpressionValue.toStringResult(variantResult)
|
||||
Reducer_Value.toStringResult(variantResult)
|
||||
|
||||
@genType
|
||||
let getArray = (variant: squiggleValue): option<squiggleValue_Array> =>
|
||||
|
|
|
@ -3,8 +3,8 @@ type squiggleValue = ForTS_SquiggleValue.squiggleValue
|
|||
|
||||
@genType
|
||||
let getValues = (v: squiggleValue_Array): array<squiggleValue> =>
|
||||
ReducerInterface_InternalExpressionValue.arrayToValueArray(v)
|
||||
Reducer_Value.arrayToValueArray(v)
|
||||
|
||||
@genType
|
||||
let toString = (v: squiggleValue_Array): string =>
|
||||
ReducerInterface_InternalExpressionValue.toStringArray(v)
|
||||
Reducer_Value.toStringArray(v)
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
@genType
|
||||
let toString = (v: squiggleValue_Declaration): string =>
|
||||
ReducerInterface_InternalExpressionValue.toStringDeclaration(v)
|
||||
Reducer_Value.toStringDeclaration(v)
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
@genType
|
||||
let toString = (v: squiggleValue_Distribution): string =>
|
||||
ReducerInterface_InternalExpressionValue.toStringDistribution(v)
|
||||
Reducer_Value.toStringDistribution(v)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
@genType
|
||||
let toString = (v: squiggleValue_Lambda): string =>
|
||||
ReducerInterface_InternalExpressionValue.toStringFunction(v)
|
||||
Reducer_Value.toStringFunction(v)
|
||||
|
||||
@genType
|
||||
let parameters = (v: squiggleValue_Lambda): array<string> => {
|
||||
|
|
|
@ -3,10 +3,10 @@ type squiggleValue = ForTS_SquiggleValue.squiggleValue //use
|
|||
|
||||
@genType
|
||||
let getKeyValuePairs = (value: squiggleValue_Record): array<(string, squiggleValue)> =>
|
||||
ReducerInterface_InternalExpressionValue.recordToKeyValuePairs(value)
|
||||
Reducer_Value.recordToKeyValuePairs(value)
|
||||
|
||||
@genType
|
||||
let toString = (v: squiggleValue_Record) => ReducerInterface_InternalExpressionValue.toStringMap(v)
|
||||
let toString = (v: squiggleValue_Record) => Reducer_Value.toStringMap(v)
|
||||
|
||||
@genType
|
||||
let toSquiggleValue = (v: squiggleValue_Record): squiggleValue => IEvRecord(v)
|
||||
|
|
|
@ -3,8 +3,8 @@ type squiggleValue = ForTS_SquiggleValue.squiggleValue //use
|
|||
|
||||
@genType
|
||||
let getKeyValuePairs = (value: squiggleValue_Type): array<(string, squiggleValue)> =>
|
||||
ReducerInterface_InternalExpressionValue.recordToKeyValuePairs(value)
|
||||
Reducer_Value.recordToKeyValuePairs(value)
|
||||
|
||||
@genType
|
||||
let toString = (value: squiggleValue_Type): string =>
|
||||
ReducerInterface_InternalExpressionValue.toStringType(value)
|
||||
Reducer_Value.toStringType(value)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
type internalExpressionValue = Reducer_T.value
|
||||
type internalExpressionValueType = ReducerInterface_InternalExpressionValue.internalExpressionValueType
|
||||
type internalExpressionValueType = Reducer_Value.internalExpressionValueType
|
||||
type errorValue = Reducer_ErrorValue.errorValue
|
||||
|
||||
/*
|
||||
|
@ -51,11 +50,11 @@ type fnDefinition = {
|
|||
name: string,
|
||||
inputs: array<frType>,
|
||||
run: (
|
||||
array<internalExpressionValue>,
|
||||
array<Reducer_T.value>,
|
||||
array<frValue>,
|
||||
Reducer_T.environment,
|
||||
Reducer_T.reducerFn,
|
||||
) => result<internalExpressionValue, errorValue>,
|
||||
) => result<Reducer_T.value, errorValue>,
|
||||
}
|
||||
|
||||
type function = {
|
||||
|
@ -92,7 +91,7 @@ module FRType = {
|
|||
| FRTypeAny => `any`
|
||||
}
|
||||
|
||||
let rec toFrValue = (r: internalExpressionValue): option<frValue> =>
|
||||
let rec toFrValue = (r: Reducer_T.value): option<frValue> =>
|
||||
// not all value variants are supported, but it's not important (we'll probably deprecate frValues soon anyway)
|
||||
switch r {
|
||||
| IEvNumber(f) => Some(FRValueNumber(f))
|
||||
|
@ -109,7 +108,7 @@ module FRType = {
|
|||
| _ => None
|
||||
}
|
||||
|
||||
let rec matchWithExpressionValue = (t: t, r: internalExpressionValue): option<frValue> =>
|
||||
let rec matchWithExpressionValue = (t: t, r: Reducer_T.value): option<frValue> =>
|
||||
switch (t, r) {
|
||||
| (FRTypeAny, f) => toFrValue(f)
|
||||
| (FRTypeString, IEvString(f)) => Some(FRValueString(f))
|
||||
|
@ -149,7 +148,7 @@ module FRType = {
|
|||
| _ => None
|
||||
}
|
||||
|
||||
let rec matchReverse = (e: frValue): internalExpressionValue =>
|
||||
let rec matchReverse = (e: frValue): Reducer_T.value =>
|
||||
switch e {
|
||||
| FRValueNumber(f) => IEvNumber(f)
|
||||
| FRValueBool(f) => IEvBool(f)
|
||||
|
@ -182,7 +181,7 @@ module FRType = {
|
|||
|
||||
let matchWithExpressionValueArray = (
|
||||
inputs: array<t>,
|
||||
args: array<internalExpressionValue>,
|
||||
args: array<Reducer_T.value>,
|
||||
): option<array<frValue>> => {
|
||||
let isSameLength = E.A.length(inputs) == E.A.length(args)
|
||||
if !isSameLength {
|
||||
|
@ -203,7 +202,7 @@ module FnDefinition = {
|
|||
t.name ++ `(${inputs})`
|
||||
}
|
||||
|
||||
let isMatch = (t: t, args: array<internalExpressionValue>) => {
|
||||
let isMatch = (t: t, args: array<Reducer_T.value>) => {
|
||||
let argValues = FRType.matchWithExpressionValueArray(t.inputs, args)
|
||||
switch argValues {
|
||||
| Some(_) => true
|
||||
|
@ -213,7 +212,7 @@ module FnDefinition = {
|
|||
|
||||
let run = (
|
||||
t: t,
|
||||
args: array<internalExpressionValue>,
|
||||
args: array<Reducer_T.value>,
|
||||
env: Reducer_T.environment,
|
||||
reducer: Reducer_T.reducerFn,
|
||||
) => {
|
||||
|
@ -317,10 +316,10 @@ module Registry = {
|
|||
let call = (
|
||||
registry,
|
||||
fnName: string,
|
||||
args: array<internalExpressionValue>,
|
||||
args: array<Reducer_T.value>,
|
||||
env: Reducer_T.environment,
|
||||
reducer: Reducer_T.reducerFn,
|
||||
): result<internalExpressionValue, errorValue> => {
|
||||
): result<Reducer_T.value, errorValue> => {
|
||||
switch Belt.Map.String.get(registry.fnNameDict, fnName) {
|
||||
| Some(definitions) => {
|
||||
let showNameMatchDefinitions = () => {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
type t = Reducer_T.bindings
|
||||
type internalExpressionValue = Reducer_T.value
|
||||
|
||||
let rec get = ({namespace, parent}: t, id: string) => {
|
||||
switch namespace->Reducer_Namespace.get(id) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
type t = Reducer_T.context
|
||||
|
||||
let defaultEnvironment: Reducer_T.environment = DistributionOperation.defaultEnv
|
||||
|
||||
let createContext = (stdLib: Reducer_Namespace.t, environment: Reducer_T.environment): t => {
|
||||
{
|
||||
bindings: stdLib->Reducer_Bindings.fromNamespace->Reducer_Bindings.extend,
|
||||
|
@ -8,7 +10,4 @@ let createContext = (stdLib: Reducer_Namespace.t, environment: Reducer_T.environ
|
|||
}
|
||||
|
||||
let createDefaultContext = (): t =>
|
||||
createContext(
|
||||
ReducerInterface_StdLib.internalStdLib,
|
||||
ReducerInterface_InternalExpressionValue.defaultEnvironment,
|
||||
)
|
||||
createContext(SquiggleLibrary_StdLib.stdLib, defaultEnvironment)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// module ProjectAccessorsT = ReducerProject_ProjectAccessors_T
|
||||
// module T = Reducer_Dispatch_T
|
||||
// module TypeChecker = Reducer_Type_TypeChecker
|
||||
// open ReducerInterface_InternalExpressionValue
|
||||
// open Reducer_Value
|
||||
|
||||
// type errorValue = Reducer_ErrorValue.errorValue
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
// module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
// module ExpressionT = Reducer_Expression_T
|
||||
// module ProjectAccessorsT = ReducerProject_ProjectAccessors_T
|
||||
|
||||
// // Each piece of the dispatch chain computes the result or returns None so that the chain can continue
|
||||
// type dispatchChainPiece = (
|
||||
// InternalExpressionValue.functionCall,
|
||||
// Reducer_Value.functionCall,
|
||||
// ProjectAccessorsT.t,
|
||||
// ) => option<result<Reducer_T.value, Reducer_ErrorValue.errorValue>>
|
||||
|
||||
// type dispatchChainPieceWithReducer = (
|
||||
// InternalExpressionValue.functionCall,
|
||||
// Reducer_Value.functionCall,
|
||||
// ProjectAccessorsT.t,
|
||||
// Reducer_T.reducerFn,
|
||||
// ) => option<result<Reducer_T.value, Reducer_ErrorValue.errorValue>>
|
||||
|
|
|
@ -103,7 +103,7 @@ let rec evaluate: T.reducerFn = (expression, context): (T.value, T.context) => {
|
|||
context,
|
||||
)
|
||||
| _ =>
|
||||
RENotAFunction(lambda->ReducerInterface_InternalExpressionValue.toString)
|
||||
RENotAFunction(lambda->Reducer_Value.toString)
|
||||
->Reducer_ErrorValue.ErrorException
|
||||
->raise
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
module Bindings = Reducer_Bindings
|
||||
module ErrorValue = Reducer_ErrorValue
|
||||
|
||||
type internalExpressionValue = ReducerInterface_InternalExpressionValue.t
|
||||
|
||||
let doLambdaCall = (
|
||||
lambdaValue: Reducer_T.lambdaValue,
|
||||
args,
|
||||
|
@ -21,6 +18,7 @@ let makeLambda = (
|
|||
|
||||
// Note: with this implementation, FFI lambdas (created by other methods than calling `makeLambda`) are allowed to violate the rules, pollute the bindings, etc.
|
||||
// Not sure yet if that's a bug or a feature.
|
||||
// FunctionRegistry functions are unaffected by this, their API is too limited.
|
||||
|
||||
let lambda = (
|
||||
arguments: array<Reducer_T.value>,
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
An expression is an intermediate representation of a Squiggle code.
|
||||
Expressions are evaluated by `Reducer_Expression.evaluate` function.
|
||||
*/
|
||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
|
||||
type t = Reducer_T.expression
|
||||
|
||||
let commaJoin = values => values->Reducer_Extra_Array.intersperse(", ")->Js.String.concatMany("")
|
||||
|
@ -27,7 +25,7 @@ let rec toString = (expression: t) =>
|
|||
| EAssign(name, value) => `${name} = ${value->toString}`
|
||||
| ECall(fn, args) => `(${fn->toString})(${args->Js.Array2.map(toString)->commaJoin})`
|
||||
| ELambda(parameters, body) => `{|${parameters->commaJoin}| ${body->toString}}`
|
||||
| EValue(aValue) => InternalExpressionValue.toString(aValue)
|
||||
| EValue(aValue) => Reducer_Value.toString(aValue)
|
||||
}
|
||||
|
||||
let toStringResult = codeResult =>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
module Gate = Reducer_Js_Gate
|
|
@ -1,17 +0,0 @@
|
|||
open ReducerInterface_InternalExpressionValue
|
||||
open Reducer_ErrorValue
|
||||
|
||||
external castBool: unit => bool = "%identity"
|
||||
external castNumber: unit => float = "%identity"
|
||||
external castString: unit => string = "%identity"
|
||||
|
||||
/*
|
||||
As JavaScript returns us any type, we need to type check and cast type propertype before using it
|
||||
*/
|
||||
let jsToIEv = (jsValue): result<internalExpressionValue, errorValue> =>
|
||||
switch Js.typeof(jsValue) {
|
||||
| "boolean" => jsValue->castBool->IEvBool->Ok
|
||||
| "number" => jsValue->castNumber->IEvNumber->Ok
|
||||
| "string" => jsValue->castString->IEvString->Ok
|
||||
| other => RETodo(`Unhandled MathJs literal type: ${Js.String.make(other)}`)->Error
|
||||
}
|
|
@ -25,7 +25,7 @@ let toString = (namespace: t) =>
|
|||
namespace
|
||||
->Belt.Map.String.toArray
|
||||
->Belt.Array.map(((eachKey, eachValue)) =>
|
||||
`${eachKey}: ${eachValue->ReducerInterface_InternalExpressionValue.toString}`
|
||||
`${eachKey}: ${eachValue->Reducer_Value.toString}`
|
||||
)
|
||||
->Js.Array2.toString
|
||||
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
// module Bindings = Reducer_Bindings
|
||||
// module ErrorValue = Reducer_ErrorValue
|
||||
// module Expression = Reducer_Expression
|
||||
// module ExpressionT = Reducer_Expression_T
|
||||
// module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
// module ProjectAccessorsT = ReducerProject_ProjectAccessors_T
|
||||
// module T = Reducer_Type_T
|
||||
|
||||
// let ievFromTypeExpression = (
|
||||
// typeExpressionSourceCode: string,
|
||||
// reducerFn: ProjectReducerFnT.t,
|
||||
// ): result<InternalExpressionValue.t, ErrorValue.t> => {
|
||||
// ): result<Reducer_Value.t, ErrorValue.t> => {
|
||||
// let sIndex = "compiled"
|
||||
// let sourceCode = `type ${sIndex}=${typeExpressionSourceCode}`
|
||||
// Reducer_Expression.BackCompatible.parse(sourceCode)->Belt.Result.flatMap(expr => {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
module T = Reducer_Type_T
|
||||
|
||||
let isMin = (modifierArg: InternalExpressionValue.t, aValue: InternalExpressionValue.t): bool => {
|
||||
let isMin = (modifierArg: Reducer_Value.t, aValue: Reducer_Value.t): bool => {
|
||||
let pair = (modifierArg, aValue)
|
||||
switch pair {
|
||||
| (IEvNumber(a), IEvNumber(b)) => a <= b
|
||||
|
@ -9,7 +8,7 @@ let isMin = (modifierArg: InternalExpressionValue.t, aValue: InternalExpressionV
|
|||
}
|
||||
}
|
||||
|
||||
let isMax = (modifierArg: InternalExpressionValue.t, aValue: InternalExpressionValue.t): bool => {
|
||||
let isMax = (modifierArg: Reducer_Value.t, aValue: Reducer_Value.t): bool => {
|
||||
let pair = (modifierArg, aValue)
|
||||
switch pair {
|
||||
| (IEvNumber(a), IEvNumber(b)) => a >= b
|
||||
|
@ -18,8 +17,8 @@ let isMax = (modifierArg: InternalExpressionValue.t, aValue: InternalExpressionV
|
|||
}
|
||||
|
||||
let isMemberOf = (
|
||||
modifierArg: InternalExpressionValue.t,
|
||||
aValue: InternalExpressionValue.t,
|
||||
modifierArg: Reducer_Value.t,
|
||||
aValue: Reducer_Value.t,
|
||||
): bool => {
|
||||
let pair = (modifierArg, aValue)
|
||||
switch pair {
|
||||
|
@ -30,8 +29,8 @@ let isMemberOf = (
|
|||
|
||||
let checkModifier = (
|
||||
key: string,
|
||||
modifierArg: InternalExpressionValue.t,
|
||||
aValue: InternalExpressionValue.t,
|
||||
modifierArg: Reducer_Value.t,
|
||||
aValue: Reducer_Value.t,
|
||||
): bool =>
|
||||
switch key {
|
||||
| "min" => isMin(modifierArg, aValue)
|
||||
|
@ -41,8 +40,8 @@ let checkModifier = (
|
|||
}
|
||||
|
||||
let checkModifiers = (
|
||||
contracts: Belt.Map.String.t<InternalExpressionValue.t>,
|
||||
aValue: InternalExpressionValue.t,
|
||||
contracts: Belt.Map.String.t<Reducer_Value.t>,
|
||||
aValue: Reducer_Value.t,
|
||||
): bool => {
|
||||
contracts->Belt.Map.String.reduce(true, (acc, key, modifierArg) =>
|
||||
switch acc {
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
// module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
// open InternalExpressionValue
|
||||
|
||||
// type rec iType =
|
||||
// | ItTypeIdentifier(string)
|
||||
// | ItModifiedType({modifiedType: iType, contracts: Belt.Map.String.t<InternalExpressionValue.t>})
|
||||
// | ItModifiedType({modifiedType: iType, contracts: Belt.Map.String.t<Reducer_Value.t>})
|
||||
// | ItTypeOr({typeOr: array<iType>})
|
||||
// | ItTypeFunction({inputs: array<iType>, output: iType})
|
||||
// | ItTypeArray({element: iType})
|
||||
|
@ -11,14 +8,14 @@
|
|||
// | ItTypeRecord({properties: Belt.Map.String.t<iType>})
|
||||
|
||||
// type t = iType
|
||||
// type typeErrorValue = TypeMismatch(t, InternalExpressionValue.t)
|
||||
// type typeErrorValue = TypeMismatch(t, Reducer_Value.t)
|
||||
|
||||
// let rec toString = (t: t): string => {
|
||||
// switch t {
|
||||
// | ItTypeIdentifier(s) => s
|
||||
// | ItModifiedType({modifiedType, contracts}) =>
|
||||
// `${toString(modifiedType)}${contracts->Belt.Map.String.reduce("", (acc, k, v) =>
|
||||
// Js.String2.concatMany(acc, ["<-", k, "(", InternalExpressionValue.toString(v), ")"])
|
||||
// Js.String2.concatMany(acc, ["<-", k, "(", Reducer_Value.toString(v), ")"])
|
||||
// )}`
|
||||
// | ItTypeOr({typeOr}) => `(${Js.Array2.map(typeOr, toString)->Js.Array2.joinWith(" | ")})`
|
||||
// | ItTypeFunction({inputs, output}) =>
|
||||
|
@ -41,42 +38,42 @@
|
|||
|
||||
// let rec fromTypeMap = typeMap => {
|
||||
// let default = IEvString("")
|
||||
// let evTypeTag: InternalExpressionValue.t = Belt.Map.String.getWithDefault(
|
||||
// let evTypeTag: Reducer_Value.t = Belt.Map.String.getWithDefault(
|
||||
// typeMap,
|
||||
// "typeTag",
|
||||
// default,
|
||||
// )
|
||||
// let evTypeIdentifier: InternalExpressionValue.t = Belt.Map.String.getWithDefault(
|
||||
// let evTypeIdentifier: Reducer_Value.t = Belt.Map.String.getWithDefault(
|
||||
// typeMap,
|
||||
// "typeIdentifier",
|
||||
// default,
|
||||
// )
|
||||
// let evTypeOr: InternalExpressionValue.t = Belt.Map.String.getWithDefault(
|
||||
// let evTypeOr: Reducer_Value.t = Belt.Map.String.getWithDefault(
|
||||
// typeMap,
|
||||
// "typeOr",
|
||||
// default,
|
||||
// )
|
||||
// let evInputs: InternalExpressionValue.t = Belt.Map.String.getWithDefault(
|
||||
// let evInputs: Reducer_Value.t = Belt.Map.String.getWithDefault(
|
||||
// typeMap,
|
||||
// "inputs",
|
||||
// default,
|
||||
// )
|
||||
// let evOutput: InternalExpressionValue.t = Belt.Map.String.getWithDefault(
|
||||
// let evOutput: Reducer_Value.t = Belt.Map.String.getWithDefault(
|
||||
// typeMap,
|
||||
// "output",
|
||||
// default,
|
||||
// )
|
||||
// let evElement: InternalExpressionValue.t = Belt.Map.String.getWithDefault(
|
||||
// let evElement: Reducer_Value.t = Belt.Map.String.getWithDefault(
|
||||
// typeMap,
|
||||
// "element",
|
||||
// default,
|
||||
// )
|
||||
// let evElements: InternalExpressionValue.t = Belt.Map.String.getWithDefault(
|
||||
// let evElements: Reducer_Value.t = Belt.Map.String.getWithDefault(
|
||||
// typeMap,
|
||||
// "elements",
|
||||
// default,
|
||||
// )
|
||||
// let evProperties: InternalExpressionValue.t = Belt.Map.String.getWithDefault(
|
||||
// let evProperties: Reducer_Value.t = Belt.Map.String.getWithDefault(
|
||||
// typeMap,
|
||||
// "properties",
|
||||
// default,
|
||||
|
@ -101,18 +98,18 @@
|
|||
// : ItModifiedType({modifiedType: makeIt, contracts: contracts})
|
||||
// }
|
||||
|
||||
// and fromIEvValue = (ievValue: InternalExpressionValue.t): iType =>
|
||||
// and fromIEvValue = (ievValue: Reducer_Value.t): iType =>
|
||||
// switch ievValue {
|
||||
// | IEvTypeIdentifier(typeIdentifier) => ItTypeIdentifier({typeIdentifier})
|
||||
// | IEvType(typeMap) => fromTypeMap(typeMap)
|
||||
// | _ => raise(Reducer_Exception.ImpossibleException("Reducer_Type_T-ievValue"))
|
||||
// }
|
||||
// and fromIEvArray = (ievArray: InternalExpressionValue.t) =>
|
||||
// and fromIEvArray = (ievArray: Reducer_Value.t) =>
|
||||
// switch ievArray {
|
||||
// | IEvArray(array) => array->Belt.Array.map(fromIEvValue)
|
||||
// | _ => raise(Reducer_Exception.ImpossibleException("Reducer_Type_T-ievArray"))
|
||||
// }
|
||||
// and fromIEvRecord = (ievRecord: InternalExpressionValue.t) =>
|
||||
// and fromIEvRecord = (ievRecord: Reducer_Value.t) =>
|
||||
// switch ievRecord {
|
||||
// | IEvRecord(record) => record->Belt.Map.String.map(fromIEvValue)
|
||||
// | _ => raise(Reducer_Exception.ImpossibleException("Reducer_Type_T-ievRecord"))
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
// module ExpressionT = Reducer_Expression_T
|
||||
// module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
// module ProjectAccessorsT = ReducerProject_ProjectAccessors_T
|
||||
// module T = Reducer_Type_T
|
||||
// module TypeContracts = Reducer_Type_Contracts
|
||||
// open InternalExpressionValue
|
||||
// open Reducer_Value
|
||||
|
||||
// let rec isITypeOf = (anIType: T.iType, aValue): result<bool, T.typeErrorValue> => {
|
||||
// let caseTypeIdentifier = (anUpperTypeName, aValue) => {
|
||||
|
@ -98,8 +97,8 @@
|
|||
// let caseModifiedType = (
|
||||
// anIType: T.iType,
|
||||
// modifiedType: T.iType,
|
||||
// contracts: Belt.Map.String.t<InternalExpressionValue.t>,
|
||||
// aValue: InternalExpressionValue.t,
|
||||
// contracts: Belt.Map.String.t<Reducer_Value.t>,
|
||||
// aValue: Reducer_Value.t,
|
||||
// ) => {
|
||||
// isITypeOf(modifiedType, aValue)->Belt.Result.flatMap(_result => {
|
||||
// if TypeContracts.checkModifiers(contracts, aValue) {
|
||||
|
@ -113,7 +112,7 @@
|
|||
// switch anIType {
|
||||
// | ItTypeIdentifier(name) => caseTypeIdentifier(name, aValue)
|
||||
// | ItModifiedType({modifiedType, contracts}) =>
|
||||
// caseModifiedType(anIType, modifiedType, contracts, aValue) //{modifiedType: iType, contracts: Belt.Map.String.t<InternalExpressionValue.t>}
|
||||
// caseModifiedType(anIType, modifiedType, contracts, aValue) //{modifiedType: iType, contracts: Belt.Map.String.t<Reducer_Value.t>}
|
||||
// | ItTypeOr({typeOr}) => caseOr(anIType, typeOr, aValue)
|
||||
// | ItTypeFunction(_) =>
|
||||
// raise(
|
||||
|
@ -129,23 +128,23 @@
|
|||
|
||||
// let isTypeOf = (
|
||||
// typeExpressionSourceCode: string,
|
||||
// aValue: InternalExpressionValue.t,
|
||||
// aValue: Reducer_Value.t,
|
||||
// reducerFn: Reducer_T.reducerFn,
|
||||
// ): result<InternalExpressionValue.t, ErrorValue.t> => {
|
||||
// ): result<Reducer_Value.t, ErrorValue.t> => {
|
||||
// switch typeExpressionSourceCode->Reducer_Type_Compile.fromTypeExpression(reducerFn) {
|
||||
// | Ok(anIType) =>
|
||||
// switch isITypeOf(anIType, aValue) {
|
||||
// | Ok(_) => Ok(aValue)
|
||||
// | Error(T.TypeMismatch(anIType, evValue)) =>
|
||||
// Error(
|
||||
// ErrorValue.REExpectedType(anIType->T.toString, evValue->InternalExpressionValue.toString),
|
||||
// ErrorValue.REExpectedType(anIType->T.toString, evValue->Reducer_Value.toString),
|
||||
// )
|
||||
// }
|
||||
// | Error(error) => Error(error) // Directly propagating - err => err - causes type mismatch
|
||||
// }
|
||||
// }
|
||||
|
||||
// let checkITypeArguments = (anIType: T.iType, args: array<InternalExpressionValue.t>): result<
|
||||
// let checkITypeArguments = (anIType: T.iType, args: array<Reducer_Value.t>): result<
|
||||
// bool,
|
||||
// T.typeErrorValue,
|
||||
// > => {
|
||||
|
@ -155,7 +154,7 @@
|
|||
// }
|
||||
// }
|
||||
|
||||
// let checkITypeArgumentsBool = (anIType: T.iType, args: array<InternalExpressionValue.t>): bool => {
|
||||
// let checkITypeArgumentsBool = (anIType: T.iType, args: array<Reducer_Value.t>): bool => {
|
||||
// switch checkITypeArguments(anIType, args) {
|
||||
// | Ok(_) => true
|
||||
// | _ => false
|
||||
|
@ -164,16 +163,16 @@
|
|||
|
||||
// let checkArguments = (
|
||||
// typeExpressionSourceCode: string,
|
||||
// args: array<InternalExpressionValue.t>,
|
||||
// args: array<Reducer_Value.t>,
|
||||
// reducerFn: ReducerT.reducerFn,
|
||||
// ): result<InternalExpressionValue.t, ErrorValue.t> => {
|
||||
// ): result<Reducer_Value.t, ErrorValue.t> => {
|
||||
// switch typeExpressionSourceCode->Reducer_Type_Compile.fromTypeExpression(reducerFn) {
|
||||
// | Ok(anIType) =>
|
||||
// switch checkITypeArguments(anIType, args) {
|
||||
// | Ok(_) => Ok(args->IEvArray)
|
||||
// | Error(T.TypeMismatch(anIType, evValue)) =>
|
||||
// Error(
|
||||
// ErrorValue.REExpectedType(anIType->T.toString, evValue->InternalExpressionValue.toString),
|
||||
// ErrorValue.REExpectedType(anIType->T.toString, evValue->Reducer_Value.toString),
|
||||
// )
|
||||
// }
|
||||
// | Error(error) => Error(error) // Directly propagating - err => err - causes type mismatch
|
||||
|
|
|
@ -5,12 +5,8 @@ module ErrorValue = Reducer_ErrorValue
|
|||
type environment = GenericDist.env
|
||||
module T = Reducer_T
|
||||
|
||||
let defaultEnvironment: environment = DistributionOperation.defaultEnv
|
||||
|
||||
type t = Reducer_T.value
|
||||
|
||||
type internalExpressionValue = t
|
||||
|
||||
type functionCall = (string, array<t>)
|
||||
|
||||
let rec toString = (aValue: T.value) =>
|
|
@ -1,2 +0,0 @@
|
|||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
module StdLib = ReducerInterface_StdLib
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
module Bindings = Reducer_Bindings
|
||||
module ErrorValue = Reducer_ErrorValue
|
||||
module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
module ProjectItem = ReducerProject_ProjectItem
|
||||
module T = ReducerProject_T
|
||||
module Topology = ReducerProject_Topology
|
||||
|
@ -19,8 +18,8 @@ let getRunOrderFor = Topology.getRunOrderFor
|
|||
let createProject = () => {
|
||||
let project: t = {
|
||||
items: Belt.MutableMap.String.make(),
|
||||
stdLib: ReducerInterface_StdLib.internalStdLib,
|
||||
environment: InternalExpressionValue.defaultEnvironment,
|
||||
stdLib: SquiggleLibrary_StdLib.stdLib,
|
||||
environment: Reducer_Context.defaultEnvironment,
|
||||
previousRunOrder: [],
|
||||
}
|
||||
project
|
||||
|
@ -143,8 +142,8 @@ let setStdLib = (project: t, value: Reducer_T.namespace): unit => {
|
|||
project.stdLib = value
|
||||
}
|
||||
|
||||
let getEnvironment = (project: t): InternalExpressionValue.environment => project.environment
|
||||
let setEnvironment = (project: t, value: InternalExpressionValue.environment): unit => {
|
||||
let getEnvironment = (project: t): Reducer_T.environment => project.environment
|
||||
let setEnvironment = (project: t, value: Reducer_T.environment): unit => {
|
||||
project.environment = value
|
||||
}
|
||||
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
// module ProjectItemT = ReducerProject_ProjectItem_T
|
||||
// module InternalExpressionValue = ReducerInterface_InternalExpressionValue
|
||||
|
||||
// type states = {mutable continuation: ProjectItemT.continuationArgumentType}
|
||||
|
||||
// type projectAccessors = {
|
||||
// stdLib: Reducer_Bindings.t,
|
||||
// environment: Reducer_T.environment,
|
||||
// states: states,
|
||||
// }
|
||||
|
||||
// type t = projectAccessors
|
||||
|
||||
// let identityAccessors: t = {
|
||||
// // We need the states at the end of the runtime.
|
||||
// // Accessors can be modified but states will stay as the same pointer
|
||||
// states: {
|
||||
// continuation: Reducer_Bindings.emptyBindings,
|
||||
// },
|
||||
// stdLib: ReducerInterface_StdLib.internalStdLib,
|
||||
// environment: InternalExpressionValue.defaultEnvironment,
|
||||
// }
|
||||
|
||||
// // to support change of environment in runtime
|
||||
// let setEnvironment = (this: t, environment: Reducer_T.environment): t => {
|
||||
// {
|
||||
// ...this,
|
||||
// environment: environment,
|
||||
// }
|
||||
// }
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
exception ErrorException = Reducer_ErrorValue.ErrorException
|
||||
|
||||
let internalStdLib: Reducer_T.namespace = {
|
||||
let stdLib: Reducer_T.namespace = {
|
||||
// constants
|
||||
let res =
|
||||
Reducer_Namespace.make()
|
|
@ -1,58 +0,0 @@
|
|||
open ForTS__Types
|
||||
/*
|
||||
This is meant as a file to contain @genType declarations as needed for Typescript.
|
||||
I would ultimately want to have all @genType declarations here, vs. other files, but
|
||||
@genType doesn't play as nicely with renaming Modules and functions as
|
||||
would be preferable.
|
||||
|
||||
The below few seem to work fine. In the future there's definitely more work to do here.
|
||||
*/
|
||||
|
||||
// For backwards compatibility:
|
||||
//Alternatives if one wants to keep the old habits
|
||||
@genType type samplingParams = environment
|
||||
@genType type squiggleValue_Dist = squiggleValue_Distribution //alternative
|
||||
@genType type genericDist = squiggleValue_Distribution //alternative
|
||||
@genType type sampleSetDist = sampleSetDistribution //alternative
|
||||
@genType type symbolicDist = symbolicDistribution //alternative
|
||||
@genType type resultDist = result<distribution, distributionError> //alternative
|
||||
@genType type resultFloat = result<float, distributionError> //alternative
|
||||
@genType type resultString = result<string, distributionError> //alternative
|
||||
|
||||
@genType
|
||||
let makeSampleSetDist: array<float> => result<
|
||||
sampleSetDist,
|
||||
SampleSetDist.sampleSetError,
|
||||
> = SampleSetDist.make
|
||||
|
||||
//TODO: ForTS Interface module candid
|
||||
@genType
|
||||
let toPointSet: (
|
||||
squiggleValue_Distribution,
|
||||
~xyPointLength: int,
|
||||
~sampleCount: int,
|
||||
~xSelection: DistributionTypes.DistributionOperation.pointsetXSelection=?,
|
||||
unit,
|
||||
) => result<PointSetTypes.pointSetDist, distributionError> = GenericDist.toPointSet
|
||||
|
||||
@genType
|
||||
type mixedShape = PointSetTypes.mixedShape
|
||||
|
||||
@genType
|
||||
type discreteShape = PointSetTypes.discreteShape
|
||||
|
||||
@genType
|
||||
type continuousShape = PointSetTypes.continuousShape
|
||||
|
||||
@genType
|
||||
let distributionErrorToString = ForTS_Distribution_Error.toString
|
||||
|
||||
@genType
|
||||
let defaultSamplingEnv = ForTS_Distribution.defaultEnvironment
|
||||
|
||||
// Umur: opaque types
|
||||
// @genType
|
||||
// type declarationArg = Declaration.arg
|
||||
|
||||
// @genType
|
||||
// type declaration<'a> = Declaration.declaration<'a>
|
Loading…
Reference in New Issue
Block a user