diff --git a/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_tutorial_test.res b/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_tutorial_test.res index 02089b36..0d2b92f3 100644 --- a/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_tutorial_test.res +++ b/packages/squiggle-lang/__tests__/ReducerProject/ReducerProject_tutorial_test.res @@ -9,7 +9,7 @@ open Expect.Operators describe("ReducerProject Tutorial", () => { describe("Single source", () => { -/* + /* Case "Running a single source". */ test("run", () => { @@ -98,7 +98,7 @@ Case "Running a single source". //TODO multiple sources //TODO multiple sources with includes. Introduction to includes //TODO multiple sources with multi level includes. Cycle detection -//TODO +//TODO //TODO: Implement a runOrder consideration - clean results based on run order. //TODO: runOrder vs setSource/touchSource //TODO: Advanced details: (below) @@ -106,4 +106,4 @@ Case "Running a single source". //TODO: dependents and reexecution //TODO: dependencies and reexecution //TODO: cleanAllResults clean -//TODO: cleanAll clean \ No newline at end of file +//TODO: cleanAll clean diff --git a/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_MyProject.res b/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_MyProject.res index f677ec42..c275b71a 100644 --- a/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_MyProject.res +++ b/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_MyProject.res @@ -1,4 +1,5 @@ open ForTS_Types @genType -let getResult = (_p: myProject): option => My_ErrorValue.EError->Error->Some +let getResult = (_p: myProject): option> => + My_ErrorValue.EError->Error->Some diff --git a/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_Result.res b/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_Result.res new file mode 100644 index 00000000..407c4a2c --- /dev/null +++ b/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_Result.res @@ -0,0 +1,18 @@ +open ForTS_Types + +@genType let isError = (r: result_<'a, 'e>): bool => Belt.Result.isError(r) +@genType let isOk = (r: result_<'a, 'e>): bool => Belt.Result.isOk(r) + +@genType +let getError = (r: result_<'a, 'e>): option<'e> => + switch r { + | Ok(_) => None + | Error(e) => Some(e) + } + +@genType +let getValue = (r: result_<'a, 'e>): option<'a> => + switch r { + | Ok(v) => Some(v) + | Error(_) => None + } diff --git a/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_Result/ForTS_Result_InternalValue.res b/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_Result/ForTS_Result_InternalValue.res deleted file mode 100644 index fd55b6ff..00000000 --- a/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_Result/ForTS_Result_InternalValue.res +++ /dev/null @@ -1,18 +0,0 @@ -open ForTS_Types - -@genType let isError = (r: result_internalValue): bool => Belt.Result.isError(r) -@genType let isOk = (r: result_internalValue): bool => Belt.Result.isOk(r) - -@genType -let getError = (r: result_internalValue): option => - switch r { - | Ok(_) => None - | Error(e) => Some(e) - } - -@genType -let getValue = (r: result_internalValue): option => - switch r { - | Ok(v) => Some(v) - | Error(_) => None - } diff --git a/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_Types.res b/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_Types.res index 4345c405..7efcc47d 100644 --- a/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_Types.res +++ b/packages/squiggle-lang/src/rescript/Dummy-TypeScriptingRescript/ForTS/ForTS_Types.res @@ -6,7 +6,7 @@ @genType.opaque type recordLike = MyInterface_InternalValue_RecordLike.t @genType.opaque type internalVoid = int @genType.opaque type errorValue = My_ErrorValue.t -@genType.opaque type result_internalValue = result // There has to be a type for each result permutation +@genType.opaque type result_<'a, 'e> = result<'a, 'e> // There has to be a type for each result permutation @genType.opaque type myProject = {name: string} //There is no need to map option<> as it becomes nullable