squiggle/packages/squiggle-lang/src/rescript/Reducer
Vyacheslav Matyukhin 92483e66e0
yarn format
2022-09-20 02:19:55 +04:00
..
Reducer_Dispatch cleanups; ReducerInterface is no more 2022-09-19 23:10:09 +04:00
Reducer_Expression yarn format 2022-09-20 02:19:55 +04:00
Reducer_Extra spell check 2022-07-16 17:09:39 +02:00
Reducer_Peggy fix more tests; FR improvements/refactorings 2022-09-19 15:00:38 +04:00
Reducer_Type yarn format 2022-09-20 02:19:55 +04:00
README.md format, rename, simplify 2022-03-29 11:09:59 +02:00
Reducer_Bindings.res cleanups; ReducerInterface is no more 2022-09-19 23:10:09 +04:00
Reducer_Context.res yarn format 2022-09-20 02:19:55 +04:00
Reducer_ErrorValue.res value vs result conversion functions 2022-09-09 00:43:21 +02:00
Reducer_Exception.res basic type compiler 2022-07-16 16:13:39 +02:00
Reducer_Namespace.res yarn format 2022-09-20 02:19:55 +04:00
Reducer_T.res remove IEvArrayString, implement __result__, cleanups 2022-09-18 03:15:58 +04:00
Reducer_Value.res cleanups; ReducerInterface is no more 2022-09-19 23:10:09 +04: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)"))