squiggle/packages/squiggle-lang/src/rescript/Reducer
2022-06-23 04:03:14 +02:00
..
Reducer_Category Reducer InternalExpressionValue created 2022-06-23 02:25:54 +02:00
Reducer_Dispatch Reducer InternalExpressionValue created 2022-06-23 02:25:54 +02:00
Reducer_Expression fix typescript test 2022-06-23 04:03:14 +02:00
Reducer_Extra format, rename, simplify 2022-03-29 11:09:59 +02:00
Reducer_Js Reducer InternalExpressionValue created 2022-06-23 02:25:54 +02:00
Reducer_MathJs Reducer InternalExpressionValue created 2022-06-23 02:25:54 +02:00
Reducer_Peggy module access to expression 2022-06-09 14:57:25 +02:00
README.md format, rename, simplify 2022-03-29 11:09:59 +02:00
Reducer_ErrorValue.res numbers with units (tested) 2022-05-23 08:13:51 +02:00
Reducer.res Reducer InternalExpressionValue created 2022-06-23 02:25:54 +02:00
Reducer.resi ternary operator (tested) 2022-05-04 22:36:34 +02:00

To interface your library there only 2 files to be modified:

  • Reducer/ReducerInterface/ReducerInterface_ExpressionValue.res

    This is where your additional types are referred for the dispatcher.

  • Reducer/ReducerInterface/ReducerInterface_ExternalLibrary.res

    This is where dispatching to your library is done. If the dispatcher becomes beastly then feel free to divide it into submodules.

The Reducer is built to use different external libraries as well as different external parsers. Both external parsers and external libraries are plugins.

And finally try using Reducer.eval to how your extentions look:

  test("1+2", () => expectEvalToBe( "1+2", "Ok(3)"))