squiggle/packages/squiggle-lang/src/rescript/Reducer
2022-06-26 12:13:38 +03:00
..
Reducer_Category PR comments 2022-06-24 12:15:38 +02:00
Reducer_Dispatch PR comments 2022-06-24 12:15:38 +02:00
Reducer_Expression Merge pull request #752 from quantified-uncertainty/reducer-typescript-wall 2022-06-24 05:43:21 -07:00
Reducer_Extra format, rename, simplify 2022-03-29 11:09:59 +02:00
Reducer_Js PR comments 2022-06-24 12:15:38 +02:00
Reducer_MathJs PR comments 2022-06-24 12:15:38 +02:00
Reducer_Peggy peggy: require instead of import, fixes tests 2022-06-26 12:13:38 +03:00
README.md format, rename, simplify 2022-03-29 11:09:59 +02:00
Reducer_ErrorValue.res store location on RESyntaxError; export parse() function 2022-06-22 00:34:35 +03:00
Reducer.res PR comments 2022-06-24 12:15:38 +02:00
Reducer.resi PR comments 2022-06-24 12:15:38 +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)"))