Merge branch 'reducer-typecheck2' into reducer-typecheck

This commit is contained in:
Umur Ozkul 2022-07-18 18:52:49 +02:00
commit fa2561306d
2 changed files with 3 additions and 4 deletions

View File

@ -255,11 +255,10 @@ let dispatch = (call: functionCall, environment, reducer: ExpressionT.reducerFn)
errorValue, errorValue,
> => > =>
try { try {
let callInternalWithReducer = (call, environment) => callInternal(call, environment, reducer)
let (fn, args) = call let (fn, args) = call
// There is a bug that prevents string match in patterns // There is a bug that prevents string match in patterns
// So we have to recreate a copy of the string // So we have to recreate a copy of the string
ExternalLibrary.dispatch((Js.String.make(fn), args), environment, callInternalWithReducer) ExternalLibrary.dispatch((Js.String.make(fn), args), environment, reducer, callInternal)
} catch { } catch {
| Js.Exn.Error(obj) => REJavaScriptExn(Js.Exn.message(obj), Js.Exn.name(obj))->Error | Js.Exn.Error(obj) => REJavaScriptExn(Js.Exn.message(obj), Js.Exn.name(obj))->Error
| _ => RETodo("unhandled rescript exception")->Error | _ => RETodo("unhandled rescript exception")->Error

View File

@ -23,7 +23,7 @@ let tryRegistry = ((fnName, args): InternalExpressionValue.functionCall, env) =>
) )
} }
let dispatch = (call: InternalExpressionValue.functionCall, environment, chain): result< let dispatch = (call: InternalExpressionValue.functionCall, environment, reducer, chain): result<
internalExpressionValue, internalExpressionValue,
'e, 'e,
> => { > => {
@ -33,7 +33,7 @@ let dispatch = (call: InternalExpressionValue.functionCall, environment, chain):
() => ReducerInterface_Duration.dispatch(call, environment), () => ReducerInterface_Duration.dispatch(call, environment),
() => ReducerInterface_Number.dispatch(call, environment), () => ReducerInterface_Number.dispatch(call, environment),
() => tryRegistry(call, environment), () => tryRegistry(call, environment),
])->E.O2.default(chain(call, environment)) ])->E.O2.default(chain(call, environment, reducer))
} }
/* /*
If your dispatch is too big you can divide it into smaller dispatches and pass the call so that it gets called finally. If your dispatch is too big you can divide it into smaller dispatches and pass the call so that it gets called finally.