From ecf9d434011772cd6c3466372ac71933ceabb684 Mon Sep 17 00:00:00 2001 From: Sam Nolan Date: Fri, 30 Sep 2022 10:34:15 +1000 Subject: [PATCH] Format rescript --- .../components/SquiggleViewer/ExpressionViewer.tsx | 4 +++- packages/squiggle-lang/src/rescript/FR/FR_Dict.res | 3 ++- .../squiggle-lang/src/rescript/FR/FR_Pointset.res | 3 ++- .../FunctionRegistry/FunctionRegistry_Core.res | 11 ++++------- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/components/src/components/SquiggleViewer/ExpressionViewer.tsx b/packages/components/src/components/SquiggleViewer/ExpressionViewer.tsx index 8bd32292..cb40c509 100644 --- a/packages/components/src/components/SquiggleViewer/ExpressionViewer.tsx +++ b/packages/components/src/components/SquiggleViewer/ExpressionViewer.tsx @@ -298,7 +298,9 @@ export const ExpressionViewer: React.FC = ({ value, width }) => { {() => (
No display for type: {" "} - {value.tag} + + {(value as { tag: string }).tag} +
)} diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Dict.res b/packages/squiggle-lang/src/rescript/FR/FR_Dict.res index d135717c..77ca49a7 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Dict.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Dict.res @@ -71,7 +71,8 @@ let library = [ ~inputs=[FRTypeArray(FRTypeDict(FRTypeAny))], ~run=(inputs, _, _) => { switch inputs { - | [IEvArray(dicts)] => dicts + | [IEvArray(dicts)] => + dicts ->Belt.Array.map(dictValue => switch dictValue { | IEvRecord(dict) => dict diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res b/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res index ee4f7ca8..a12164bd 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Pointset.res @@ -7,7 +7,8 @@ let requiresNamespace = true let inputsToDist = (inputs: array, xyShapeToPointSetDist) => { // TODO - rewrite in more functional/functor-based style switch inputs { - | [IEvArray(items)] => items + | [IEvArray(items)] => + items ->Belt.Array.map(item => switch item { | IEvRecord(map) => { diff --git a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res index 5d606bb8..9683147f 100644 --- a/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res +++ b/packages/squiggle-lang/src/rescript/FunctionRegistry/FunctionRegistry_Core.res @@ -83,15 +83,12 @@ module FRType = { | (FRTypeNumeric, IEvNumber(_)) => true | (FRTypeNumeric, IEvDistribution(Symbolic(#Float(_)))) => true | (FRTypeLambda, IEvLambda(_)) => true - | (FRTypeArray(intendedType), IEvArray(elements)) => elements->Belt.Array.every(v => - matchWithValue(intendedType, v) - ) + | (FRTypeArray(intendedType), IEvArray(elements)) => + elements->Belt.Array.every(v => matchWithValue(intendedType, v)) | (FRTypeDict(r), IEvRecord(map)) => map->Belt.Map.String.valuesToArray->Belt.Array.every(v => matchWithValue(r, v)) - | (FRTypeRecord(recordParams), IEvRecord(map)) => recordParams->Belt.Array.every((( - name, - input, - )) => { + | (FRTypeRecord(recordParams), IEvRecord(map)) => + recordParams->Belt.Array.every(((name, input)) => { switch map->Belt.Map.String.get(name) { | Some(v) => matchWithValue(input, v) | None => false