Minor cleanup

This commit is contained in:
Ozzie Gooen 2022-05-22 13:02:20 -04:00
parent 949b57c426
commit 4b99e0135e
3 changed files with 8 additions and 10 deletions

View File

@ -21,9 +21,7 @@ type t = expression
Converts a Squigle code to expression
*/
let parse = (peggyCode: string): result<t, errorValue> =>
peggyCode
->Reducer_Peggy_Parse.parse
->Result.map(node => Reducer_Peggy_ToExpression.fromNode(node))
peggyCode->Reducer_Peggy_Parse.parse->Result.map(Reducer_Peggy_ToExpression.fromNode)
/*
Recursively evaluate/reduce the expression (Lisp AST)

View File

@ -87,7 +87,7 @@ let toStringResult = x =>
| Error(m) => `Error(${ErrorValue.errorToString(m)})`
}
let toStringResultOkless = codeResult =>
let toStringResultOkless = (codeResult: result<expressionValue, ErrorValue.errorValue>): string =>
switch codeResult {
| Ok(a) => toString(a)
| Error(m) => `Error(${ErrorValue.errorToString(m)})`
@ -105,7 +105,7 @@ type environment = DistributionOperation.env
@genType
let defaultEnvironment: environment = DistributionOperation.defaultEnv
type expresionValueType =
type expressionValueType =
| EvtArray
| EvtArrayString
| EvtBool
@ -117,9 +117,9 @@ type expresionValueType =
| EvtString
| EvtSymbol
type functionCallSignature = CallSignature(string, array<expresionValueType>)
type functionCallSignature = CallSignature(string, array<expressionValueType>)
type functionDefinitionSignature =
FunctionDefinitionSignature(functionCallSignature, expresionValueType)
FunctionDefinitionSignature(functionCallSignature, expressionValueType)
let valueToValueType = value =>
switch value {
@ -140,7 +140,7 @@ let functionCallToCallSignature = (functionCall: functionCall): functionCallSign
CallSignature(fn, args->Js.Array2.map(valueToValueType))
}
let valueTypeToString = (valueType: expresionValueType): string =>
let valueTypeToString = (valueType: expressionValueType): string =>
switch valueType {
| EvtArray => `Array`
| EvtArrayString => `ArrayString`

View File

@ -4295,7 +4295,7 @@
dependencies:
"@types/react" "*"
"@types/react@*", "@types/react@^18.0.9":
"@types/react@*", "@types/react@^18.0.1", "@types/react@^18.0.9":
version "18.0.9"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.9.tgz#d6712a38bd6cd83469603e7359511126f122e878"
integrity sha512-9bjbg1hJHUm4De19L1cHiW0Jvx3geel6Qczhjd0qY5VKVE2X5+x77YxAepuCwVh4vrgZJdgEJw48zrhRIeF4Nw==
@ -14522,7 +14522,7 @@ react-vega@^7.5.1:
prop-types "^15.8.1"
vega-embed "^6.5.1"
react@^18.1.0:
react@^18.0.0, react@^18.1.0:
version "18.1.0"
resolved "https://registry.yarnpkg.com/react/-/react-18.1.0.tgz#6f8620382decb17fdc5cc223a115e2adbf104890"
integrity sha512-4oL8ivCz5ZEPyclFQXaNksK3adutVS8l2xzZU0cqEFrE9Sb7fC0EFK5uEk74wIreL1DERyjvsU915j1pcT2uEQ==