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>
<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>
)}
</VariableList>

View File

@ -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

View File

@ -7,7 +7,8 @@ let requiresNamespace = true
let inputsToDist = (inputs: array<Reducer_T.value>, 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) => {

View File

@ -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