Format Rescript + fix ts error

This commit is contained in:
Sam Nolan 2022-09-30 10:36:42 +10:00
parent 32cd765969
commit 8477b0c5f7
4 changed files with 9 additions and 10 deletions

View File

@ -298,7 +298,7 @@ export const ExpressionViewer: React.FC<Props> = ({ value, width }) => {
{() => ( {() => (
<div> <div>
<span>No display for type: </span>{" "} <span>No display for type: </span>{" "}
<span className="font-semibold text-slate-600">{value.tag}</span> <span className="font-semibold text-slate-600">{(value as {tag: string}).tag}</span>
</div> </div>
)} )}
</VariableList> </VariableList>

View File

@ -71,7 +71,8 @@ let library = [
~inputs=[FRTypeArray(FRTypeDict(FRTypeAny))], ~inputs=[FRTypeArray(FRTypeDict(FRTypeAny))],
~run=(inputs, _, _) => { ~run=(inputs, _, _) => {
switch inputs { switch inputs {
| [IEvArray(dicts)] => dicts | [IEvArray(dicts)] =>
dicts
->Belt.Array.map(dictValue => ->Belt.Array.map(dictValue =>
switch dictValue { switch dictValue {
| IEvRecord(dict) => dict | IEvRecord(dict) => dict

View File

@ -7,7 +7,8 @@ let requiresNamespace = true
let inputsToDist = (inputs: array<Reducer_T.value>, xyShapeToPointSetDist) => { let inputsToDist = (inputs: array<Reducer_T.value>, xyShapeToPointSetDist) => {
// TODO - rewrite in more functional/functor-based style // TODO - rewrite in more functional/functor-based style
switch inputs { switch inputs {
| [IEvArray(items)] => items | [IEvArray(items)] =>
items
->Belt.Array.map(item => ->Belt.Array.map(item =>
switch item { switch item {
| IEvRecord(map) => { | IEvRecord(map) => {

View File

@ -83,15 +83,12 @@ module FRType = {
| (FRTypeNumeric, IEvNumber(_)) => true | (FRTypeNumeric, IEvNumber(_)) => true
| (FRTypeNumeric, IEvDistribution(Symbolic(#Float(_)))) => true | (FRTypeNumeric, IEvDistribution(Symbolic(#Float(_)))) => true
| (FRTypeLambda, IEvLambda(_)) => true | (FRTypeLambda, IEvLambda(_)) => true
| (FRTypeArray(intendedType), IEvArray(elements)) => elements->Belt.Array.every(v => | (FRTypeArray(intendedType), IEvArray(elements)) =>
matchWithValue(intendedType, v) elements->Belt.Array.every(v => matchWithValue(intendedType, v))
)
| (FRTypeDict(r), IEvRecord(map)) => | (FRTypeDict(r), IEvRecord(map)) =>
map->Belt.Map.String.valuesToArray->Belt.Array.every(v => matchWithValue(r, v)) map->Belt.Map.String.valuesToArray->Belt.Array.every(v => matchWithValue(r, v))
| (FRTypeRecord(recordParams), IEvRecord(map)) => recordParams->Belt.Array.every((( | (FRTypeRecord(recordParams), IEvRecord(map)) =>
name, recordParams->Belt.Array.every(((name, input)) => {
input,
)) => {
switch map->Belt.Map.String.get(name) { switch map->Belt.Map.String.get(name) {
| Some(v) => matchWithValue(input, v) | Some(v) => matchWithValue(input, v)
| None => false | None => false