squiggle/packages/squiggle-lang/src/rescript/Reducer
Ozzie Gooen 8fd5c6a1be Merge branch 'develop' into Documentation-auto-generation
* develop: (22 commits)
  components-lint respects components prettierignore
  format main.css and prettierignore base.css
  scoped tailwind preflight, top-level .squiggle wrapper
  grammar: identifiers with modules
  Refactored reducerInterface files
  Added simple scientific units
  Added stdev to table of stats, when needed
  Added stdev and variance to Distribution Operation Constructors
  Quick addition of stdev-variance-min-max-mode
  ⬆️ Bump @types/node from 17.0.38 to 17.0.40
  ⬆️ Bump webpack from 5.72.1 to 5.73.0
  ⬆️ Bump @storybook/react from 6.5.6 to 6.5.7
  ⬆️ Bump ts-node from 10.8.0 to 10.8.1
  ⬆️ Bump @storybook/builder-webpack5 from 6.5.6 to 6.5.7
  ⬆️ Bump peggy from 2.0.0 to 2.0.1
  ⬆️ Bump @storybook/addon-essentials from 6.5.6 to 6.5.7
  ⬆️ Bump @storybook/preset-create-react-app from 4.1.1 to 4.1.2
  ⬆️ Bump @hookform/resolvers from 2.8.10 to 2.9.0
  ⬆️ Bump typescript from 4.7.2 to 4.7.3
  ⬆️ Bump @storybook/manager-webpack5 from 6.5.6 to 6.5.7
  ...
2022-06-09 16:50:46 -07:00
..
Reducer_Dispatch Changed the name of select functions 2022-06-05 21:47:29 -07:00
Reducer_Expression typeExpression 2022-06-02 14:20:55 +02:00
Reducer_Extra format, rename, simplify 2022-03-29 11:09:59 +02:00
Reducer_Js format 2022-04-29 19:31:34 +02:00
Reducer_MathJs parser 2022-05-19 01:23:43 +02:00
Reducer_Peggy grammar: identifiers with modules 2022-06-08 17:00:17 +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 ternary operator (tested) 2022-05-04 22:36:34 +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)"))