rename and stringify enum tags

This commit is contained in:
Vyacheslav Matyukhin 2022-08-28 21:33:16 +04:00
parent b50061a91a
commit 481483e937
No known key found for this signature in database
GPG Key ID: 3D2A774C5489F96C
19 changed files with 141 additions and 144 deletions

View File

@ -1,10 +1,10 @@
import * as React from "react"; import * as React from "react";
import { import {
Distribution, SqDistribution,
result, result,
DistributionError, SqDistributionError,
resultMap, resultMap,
SquiggleRecord, SqRecord,
environment, environment,
} from "@quri/squiggle-lang"; } from "@quri/squiggle-lang";
import { Vega } from "react-vega"; import { Vega } from "react-vega";
@ -33,11 +33,11 @@ export type DistributionChartProps = {
height: number; height: number;
} & DistributionPlottingSettings; } & DistributionPlottingSettings;
export function defaultPlot(distribution: Distribution): Plot { export function defaultPlot(distribution: SqDistribution): Plot {
return { distributions: [{ name: "default", distribution }] }; return { distributions: [{ name: "default", distribution }] };
} }
export function makePlot(record: SquiggleRecord): Plot | void { export function makePlot(record: SqRecord): Plot | void {
const plotResult = parsePlot(record); const plotResult = parsePlot(record);
if (plotResult.tag === "Ok") { if (plotResult.tag === "Ok") {
return plotResult.value; return plotResult.value;
@ -129,7 +129,7 @@ const Cell: React.FC<{ children: React.ReactNode }> = ({ children }) => (
); );
type SummaryTableProps = { type SummaryTableProps = {
distribution: Distribution; distribution: SqDistribution;
environment: environment; environment: environment;
}; };
@ -147,11 +147,11 @@ const SummaryTable: React.FC<SummaryTableProps> = ({
const p90 = distribution.inv(environment, 0.9); const p90 = distribution.inv(environment, 0.9);
const p95 = distribution.inv(environment, 0.95); const p95 = distribution.inv(environment, 0.95);
const hasResult = (x: result<number, DistributionError>): boolean => const hasResult = (x: result<number, SqDistributionError>): boolean =>
x.tag === "Ok"; x.tag === "Ok";
const unwrapResult = ( const unwrapResult = (
x: result<number, DistributionError> x: result<number, SqDistributionError>
): React.ReactNode => { ): React.ReactNode => {
if (x.tag === "Ok") { if (x.tag === "Ok") {
return <NumberShower number={x.value} />; return <NumberShower number={x.value} />;

View File

@ -1,5 +1,5 @@
import * as React from "react"; import * as React from "react";
import { Lambda, environment } from "@quri/squiggle-lang"; import { SqLambda, environment } from "@quri/squiggle-lang";
import { FunctionChart1Dist } from "./FunctionChart1Dist"; import { FunctionChart1Dist } from "./FunctionChart1Dist";
import { FunctionChart1Number } from "./FunctionChart1Number"; import { FunctionChart1Number } from "./FunctionChart1Number";
import { DistributionPlottingSettings } from "./DistributionChart"; import { DistributionPlottingSettings } from "./DistributionChart";
@ -12,7 +12,7 @@ export type FunctionChartSettings = {
}; };
interface FunctionChartProps { interface FunctionChartProps {
fn: Lambda; fn: SqLambda;
chartSettings: FunctionChartSettings; chartSettings: FunctionChartSettings;
distributionPlotSettings: DistributionPlottingSettings; distributionPlotSettings: DistributionPlottingSettings;
environment: environment; environment: environment;

View File

@ -1,7 +1,12 @@
import * as React from "react"; import * as React from "react";
import _ from "lodash"; import _ from "lodash";
import type { Spec } from "vega"; import type { Spec } from "vega";
import { Distribution, result, Lambda, environment } from "@quri/squiggle-lang"; import {
SqDistribution,
result,
SqLambda,
environment,
} from "@quri/squiggle-lang";
import { createClassFromSpec } from "react-vega"; import { createClassFromSpec } from "react-vega";
import * as percentilesSpec from "../vega-specs/spec-percentiles.json"; import * as percentilesSpec from "../vega-specs/spec-percentiles.json";
import { import {
@ -37,7 +42,7 @@ export type FunctionChartSettings = {
}; };
interface FunctionChart1DistProps { interface FunctionChart1DistProps {
fn: Lambda; fn: SqLambda;
chartSettings: FunctionChartSettings; chartSettings: FunctionChartSettings;
distributionPlotSettings: DistributionPlottingSettings; distributionPlotSettings: DistributionPlottingSettings;
environment: environment; environment: environment;
@ -68,7 +73,7 @@ type errors = _.Dictionary<
}[] }[]
>; >;
type point = { x: number; value: result<Distribution, string> }; type point = { x: number; value: result<SqDistribution, string> };
let getPercentiles = ({ chartSettings, fn, environment }) => { let getPercentiles = ({ chartSettings, fn, environment }) => {
throw new Error("NOT IMPLEMENTED IN 0.4 YET"); throw new Error("NOT IMPLEMENTED IN 0.4 YET");

View File

@ -1,7 +1,7 @@
import * as React from "react"; import * as React from "react";
import _ from "lodash"; import _ from "lodash";
import type { Spec } from "vega"; import type { Spec } from "vega";
import { result, Lambda, environment } from "@quri/squiggle-lang"; import { result, SqLambda, environment } from "@quri/squiggle-lang";
import { createClassFromSpec } from "react-vega"; import { createClassFromSpec } from "react-vega";
import * as lineChartSpec from "../vega-specs/spec-line-chart.json"; import * as lineChartSpec from "../vega-specs/spec-line-chart.json";
import { ErrorAlert } from "./Alert"; import { ErrorAlert } from "./Alert";
@ -24,7 +24,7 @@ export type FunctionChartSettings = {
}; };
interface FunctionChart1NumberProps { interface FunctionChart1NumberProps {
fn: Lambda; fn: SqLambda;
chartSettings: FunctionChartSettings; chartSettings: FunctionChartSettings;
environment: environment; environment: environment;
height: number; height: number;

View File

@ -1,9 +1,5 @@
import * as React from "react"; import * as React from "react";
import { import { SqValue, environment, defaultEnvironment } from "@quri/squiggle-lang";
SquiggleValue,
environment,
defaultEnvironment,
} from "@quri/squiggle-lang";
import { useSquiggle } from "../lib/hooks"; import { useSquiggle } from "../lib/hooks";
import { SquiggleViewer } from "./SquiggleViewer"; import { SquiggleViewer } from "./SquiggleViewer";
@ -23,7 +19,7 @@ export interface SquiggleChartProps {
/** If the result is a function, the amount of stops sampled */ /** If the result is a function, the amount of stops sampled */
diagramCount?: number; diagramCount?: number;
/** When the squiggle code gets reevaluated */ /** When the squiggle code gets reevaluated */
onChange?(expr: SquiggleValue | undefined): void; onChange?(expr: SqValue | undefined): void;
/** CSS width of the element */ /** CSS width of the element */
width?: number; width?: number;
height?: number; height?: number;

View File

@ -1,9 +1,9 @@
import { ErrorValue } from "@quri/squiggle-lang"; import { SqError } from "@quri/squiggle-lang";
import React from "react"; import React from "react";
import { ErrorAlert } from "./Alert"; import { ErrorAlert } from "./Alert";
type Props = { type Props = {
error: ErrorValue; error: SqError;
}; };
export const SquiggleErrorAlert: React.FC<Props> = ({ error }) => { export const SquiggleErrorAlert: React.FC<Props> = ({ error }) => {

View File

@ -1,9 +1,5 @@
import React, { useContext } from "react"; import React, { useContext } from "react";
import { import { SqDistributionTag, SqValue, SqValueTag } from "@quri/squiggle-lang";
DistributionTag,
SquiggleValue,
SquiggleValueTag,
} from "@quri/squiggle-lang";
import { NumberShower } from "../NumberShower"; import { NumberShower } from "../NumberShower";
import { DistributionChart, defaultPlot, makePlot } from "../DistributionChart"; import { DistributionChart, defaultPlot, makePlot } from "../DistributionChart";
import { FunctionChart, FunctionChartSettings } from "../FunctionChart"; import { FunctionChart, FunctionChartSettings } from "../FunctionChart";
@ -56,7 +52,7 @@ const VariableList: React.FC<{
export interface Props { export interface Props {
/** The output of squiggle's run */ /** The output of squiggle's run */
expression: SquiggleValue; expression: SqValue;
/** Path to the current item, e.g. `['foo', 'bar', '3']` for `foo.bar[3]`; can be empty on the top-level item. */ /** Path to the current item, e.g. `['foo', 'bar', '3']` for `foo.bar[3]`; can be empty on the top-level item. */
path: string[]; path: string[];
width?: number; width?: number;
@ -77,7 +73,7 @@ export const ExpressionViewer: React.FC<Props> = ({
); );
} }
switch (expression.tag) { switch (expression.tag) {
case SquiggleValueTag.SvtNumber: case SqValueTag.Number:
return ( return (
<VariableBox path={path} heading="Number"> <VariableBox path={path} heading="Number">
{() => ( {() => (
@ -87,13 +83,13 @@ export const ExpressionViewer: React.FC<Props> = ({
)} )}
</VariableBox> </VariableBox>
); );
case SquiggleValueTag.SvtDistribution: { case SqValueTag.Distribution: {
const distType = expression.value.tag; const distType = expression.value.tag;
return ( return (
<VariableBox <VariableBox
path={path} path={path}
heading={`Distribution (${distType})\n${ heading={`Distribution (${distType})\n${
distType === DistributionTag.DtSymbolic distType === SqDistributionTag.Symbolic
? expression.value.toString() ? expression.value.toString()
: "" : ""
}`} }`}
@ -127,7 +123,7 @@ export const ExpressionViewer: React.FC<Props> = ({
</VariableBox> </VariableBox>
); );
} }
case SquiggleValueTag.SvtString: case SqValueTag.String:
return ( return (
<VariableBox path={path} heading="String"> <VariableBox path={path} heading="String">
{() => ( {() => (
@ -141,13 +137,13 @@ export const ExpressionViewer: React.FC<Props> = ({
)} )}
</VariableBox> </VariableBox>
); );
case SquiggleValueTag.SvtBool: case SqValueTag.Bool:
return ( return (
<VariableBox path={path} heading="Boolean"> <VariableBox path={path} heading="Boolean">
{() => expression.value.toString()} {() => expression.value.toString()}
</VariableBox> </VariableBox>
); );
case SquiggleValueTag.SvtSymbol: case SqValueTag.Symbol:
return ( return (
<VariableBox path={path} heading="Symbol"> <VariableBox path={path} heading="Symbol">
{() => ( {() => (
@ -158,38 +154,38 @@ export const ExpressionViewer: React.FC<Props> = ({
)} )}
</VariableBox> </VariableBox>
); );
case SquiggleValueTag.SvtCall: case SqValueTag.Call:
return ( return (
<VariableBox path={path} heading="Call"> <VariableBox path={path} heading="Call">
{() => expression.value} {() => expression.value}
</VariableBox> </VariableBox>
); );
case SquiggleValueTag.SvtArrayString: case SqValueTag.ArrayString:
return ( return (
<VariableBox path={path} heading="Array String"> <VariableBox path={path} heading="Array String">
{() => expression.value.map((r) => `"${r}"`).join(", ")} {() => expression.value.map((r) => `"${r}"`).join(", ")}
</VariableBox> </VariableBox>
); );
case SquiggleValueTag.SvtDate: case SqValueTag.Date:
return ( return (
<VariableBox path={path} heading="Date"> <VariableBox path={path} heading="Date">
{() => expression.value.toDateString()} {() => expression.value.toDateString()}
</VariableBox> </VariableBox>
); );
case SquiggleValueTag.SvtVoid: case SqValueTag.Void:
return ( return (
<VariableBox path={path} heading="Void"> <VariableBox path={path} heading="Void">
{() => "Void"} {() => "Void"}
</VariableBox> </VariableBox>
); );
case SquiggleValueTag.SvtTimeDuration: { case SqValueTag.TimeDuration: {
return ( return (
<VariableBox path={path} heading="Time Duration"> <VariableBox path={path} heading="Time Duration">
{() => <NumberShower precision={3} number={expression.value} />} {() => <NumberShower precision={3} number={expression.value} />}
</VariableBox> </VariableBox>
); );
} }
case SquiggleValueTag.SvtLambda: case SqValueTag.Lambda:
return ( return (
<VariableBox <VariableBox
path={path} path={path}
@ -223,7 +219,7 @@ export const ExpressionViewer: React.FC<Props> = ({
)} )}
</VariableBox> </VariableBox>
); );
case SquiggleValueTag.SvtDeclaration: { case SqValueTag.Declaration: {
return ( return (
<VariableBox <VariableBox
path={path} path={path}
@ -254,7 +250,7 @@ export const ExpressionViewer: React.FC<Props> = ({
</VariableBox> </VariableBox>
); );
} }
case SquiggleValueTag.SvtModule: { case SqValueTag.Module: {
return ( return (
<VariableList path={path} heading="Module"> <VariableList path={path} heading="Module">
{(_) => {(_) =>
@ -272,7 +268,7 @@ export const ExpressionViewer: React.FC<Props> = ({
</VariableList> </VariableList>
); );
} }
case SquiggleValueTag.SvtRecord: case SqValueTag.Record:
const plot = makePlot(expression.value); const plot = makePlot(expression.value);
if (plot) { if (plot) {
return ( return (
@ -330,7 +326,7 @@ export const ExpressionViewer: React.FC<Props> = ({
</VariableList> </VariableList>
); );
} }
case SquiggleValueTag.SvtArray: case SqValueTag.Array:
return ( return (
<VariableList path={path} heading="Array"> <VariableList path={path} heading="Array">
{(_) => {(_) =>

View File

@ -1,5 +1,5 @@
import { shape } from "@quri/squiggle-lang"; import { SqShape } from "@quri/squiggle-lang";
export const hasMassBelowZero = (shape: shape) => export const hasMassBelowZero = (shape: SqShape) =>
shape.continuous.some((x) => x.x <= 0) || shape.continuous.some((x) => x.x <= 0) ||
shape.discrete.some((x) => x.x <= 0); shape.discrete.some((x) => x.x <= 0);

View File

@ -1,4 +1,4 @@
import { environment, run, SquiggleValue } from "@quri/squiggle-lang"; import { environment, run, SqValue } from "@quri/squiggle-lang";
import { useEffect, useMemo } from "react"; import { useEffect, useMemo } from "react";
type SquiggleArgs = { type SquiggleArgs = {
@ -6,7 +6,7 @@ type SquiggleArgs = {
executionId?: number; executionId?: number;
// jsImports?: jsImports; // jsImports?: jsImports;
environment?: environment; environment?: environment;
onChange?: (expr: SquiggleValue | undefined) => void; onChange?: (expr: SqValue | undefined) => void;
}; };
export const useSquiggle = (args: SquiggleArgs) => { export const useSquiggle = (args: SquiggleArgs) => {

View File

@ -1,9 +1,9 @@
import * as yup from "yup"; import * as yup from "yup";
import { Distribution, result, SquiggleRecord } from "@quri/squiggle-lang"; import { SqDistribution, result, SqRecord } from "@quri/squiggle-lang";
export type LabeledDistribution = { export type LabeledDistribution = {
name: string; name: string;
distribution: Distribution; distribution: SqDistribution;
color?: string; color?: string;
}; };
@ -53,7 +53,7 @@ const schema = yup
}), }),
}); });
export function parsePlot(record: SquiggleRecord): result<Plot, string> { export function parsePlot(record: SqRecord): result<Plot, string> {
try { try {
const plotRecord = schema.validateSync(record); const plotRecord = schema.validateSync(record);
return ok({ return ok({

View File

@ -70,7 +70,7 @@ const valueMethod = <IR>(
}; };
export class SqPointSetDistribution extends SqAbstractDistribution { export class SqPointSetDistribution extends SqAbstractDistribution {
tag = Tag.DtPointSet; tag = Tag.PointSet;
value() { value() {
return valueMethod(this, RSDistribution.getPointSet); return valueMethod(this, RSDistribution.getPointSet);
@ -78,7 +78,7 @@ export class SqPointSetDistribution extends SqAbstractDistribution {
} }
export class SqSampleSetDistribution extends SqAbstractDistribution { export class SqSampleSetDistribution extends SqAbstractDistribution {
tag = Tag.DtSampleSet; tag = Tag.SampleSet;
value() { value() {
return valueMethod(this, RSDistribution.getSampleSet); return valueMethod(this, RSDistribution.getSampleSet);
@ -86,7 +86,7 @@ export class SqSampleSetDistribution extends SqAbstractDistribution {
} }
export class SqSymbolicDistribution extends SqAbstractDistribution { export class SqSymbolicDistribution extends SqAbstractDistribution {
tag = Tag.DtSymbolic; tag = Tag.Symbolic;
value() { value() {
return valueMethod(this, RSDistribution.getSymbolic); return valueMethod(this, RSDistribution.getSymbolic);
@ -94,9 +94,9 @@ export class SqSymbolicDistribution extends SqAbstractDistribution {
} }
const tagToClass = { const tagToClass = {
[Tag.DtPointSet]: SqPointSetDistribution, [Tag.PointSet]: SqPointSetDistribution,
[Tag.DtSampleSet]: SqSampleSetDistribution, [Tag.SampleSet]: SqSampleSetDistribution,
[Tag.DtSymbolic]: SqSymbolicDistribution, [Tag.Symbolic]: SqSymbolicDistribution,
} as const; } as const;
export type SqDistribution = export type SqDistribution =

View File

@ -44,7 +44,7 @@ const valueMethod = <IR>(
}; };
export class SqMixedPointSetDist extends SqAbstractPointSetDist { export class SqMixedPointSetDist extends SqAbstractPointSetDist {
tag = Tag.PstMixed as const; tag = Tag.Mixed as const;
get value(): RSPointSetDist.mixedShape { get value(): RSPointSetDist.mixedShape {
return valueMethod(this, RSPointSetDist.getMixed); return valueMethod(this, RSPointSetDist.getMixed);
@ -60,7 +60,7 @@ export class SqMixedPointSetDist extends SqAbstractPointSetDist {
} }
export class SqDiscretePointSetDist extends SqAbstractPointSetDist { export class SqDiscretePointSetDist extends SqAbstractPointSetDist {
tag = Tag.PstDiscrete as const; tag = Tag.Discrete as const;
get value(): RSPointSetDist.discreteShape { get value(): RSPointSetDist.discreteShape {
return valueMethod(this, RSPointSetDist.getDiscrete); return valueMethod(this, RSPointSetDist.getDiscrete);
@ -76,7 +76,7 @@ export class SqDiscretePointSetDist extends SqAbstractPointSetDist {
} }
export class SqContinuousPointSetDist extends SqAbstractPointSetDist { export class SqContinuousPointSetDist extends SqAbstractPointSetDist {
tag = Tag.PstContinuous as const; tag = Tag.Continuous as const;
get value(): RSPointSetDist.continuousShape { get value(): RSPointSetDist.continuousShape {
return valueMethod(this, RSPointSetDist.getContinues); return valueMethod(this, RSPointSetDist.getContinues);
@ -92,9 +92,9 @@ export class SqContinuousPointSetDist extends SqAbstractPointSetDist {
} }
const tagToClass = { const tagToClass = {
[Tag.PstMixed]: SqMixedPointSetDist, [Tag.Mixed]: SqMixedPointSetDist,
[Tag.PstDiscrete]: SqDiscretePointSetDist, [Tag.Discrete]: SqDiscretePointSetDist,
[Tag.PstContinuous]: SqContinuousPointSetDist, [Tag.Continuous]: SqContinuousPointSetDist,
} as const; } as const;
export type SqPointSetDist = export type SqPointSetDist =

View File

@ -37,7 +37,7 @@ const valueMethod = <IR>(
}; };
export class SqArrayValue extends SqAbstractValue { export class SqArrayValue extends SqAbstractValue {
tag = Tag.SvtArray as const; tag = Tag.Array as const;
get value() { get value() {
return new SqArray(valueMethod(this, RSValue.getArray)); return new SqArray(valueMethod(this, RSValue.getArray));
@ -45,7 +45,7 @@ export class SqArrayValue extends SqAbstractValue {
} }
export class SqArrayStringValue extends SqAbstractValue { export class SqArrayStringValue extends SqAbstractValue {
tag = Tag.SvtArrayString as const; tag = Tag.ArrayString as const;
get value() { get value() {
return valueMethod(this, RSValue.getArrayString); return valueMethod(this, RSValue.getArrayString);
@ -53,7 +53,7 @@ export class SqArrayStringValue extends SqAbstractValue {
} }
export class SqBoolValue extends SqAbstractValue { export class SqBoolValue extends SqAbstractValue {
tag = Tag.SvtBool as const; tag = Tag.Bool as const;
get value() { get value() {
return valueMethod(this, RSValue.getBool); return valueMethod(this, RSValue.getBool);
@ -61,7 +61,7 @@ export class SqBoolValue extends SqAbstractValue {
} }
export class SqCallValue extends SqAbstractValue { export class SqCallValue extends SqAbstractValue {
tag = Tag.SvtCall as const; tag = Tag.Call as const;
get value() { get value() {
return valueMethod(this, RSValue.getCall); return valueMethod(this, RSValue.getCall);
@ -69,7 +69,7 @@ export class SqCallValue extends SqAbstractValue {
} }
export class SqDateValue extends SqAbstractValue { export class SqDateValue extends SqAbstractValue {
tag = Tag.SvtDate as const; tag = Tag.Date as const;
get value() { get value() {
return valueMethod(this, RSValue.getDate); return valueMethod(this, RSValue.getDate);
@ -77,7 +77,7 @@ export class SqDateValue extends SqAbstractValue {
} }
export class SqDeclarationValue extends SqAbstractValue { export class SqDeclarationValue extends SqAbstractValue {
tag = Tag.SvtDeclaration as const; tag = Tag.Declaration as const;
get value() { get value() {
return new SqLambdaDeclaration(valueMethod(this, RSValue.getDeclaration)); return new SqLambdaDeclaration(valueMethod(this, RSValue.getDeclaration));
@ -85,7 +85,7 @@ export class SqDeclarationValue extends SqAbstractValue {
} }
export class SqDistributionValue extends SqAbstractValue { export class SqDistributionValue extends SqAbstractValue {
tag = Tag.SvtDistribution as const; tag = Tag.Distribution as const;
get value() { get value() {
return wrapDistribution(valueMethod(this, RSValue.getDistribution)); return wrapDistribution(valueMethod(this, RSValue.getDistribution));
@ -93,7 +93,7 @@ export class SqDistributionValue extends SqAbstractValue {
} }
export class SqLambdaValue extends SqAbstractValue { export class SqLambdaValue extends SqAbstractValue {
tag = Tag.SvtLambda as const; tag = Tag.Lambda as const;
get value() { get value() {
return new SqLambda(valueMethod(this, RSValue.getLambda)); return new SqLambda(valueMethod(this, RSValue.getLambda));
@ -101,7 +101,7 @@ export class SqLambdaValue extends SqAbstractValue {
} }
export class SqModuleValue extends SqAbstractValue { export class SqModuleValue extends SqAbstractValue {
tag = Tag.SvtModule as const; tag = Tag.Module as const;
get value() { get value() {
return new SqModule(valueMethod(this, RSValue.getModule)); return new SqModule(valueMethod(this, RSValue.getModule));
@ -109,7 +109,7 @@ export class SqModuleValue extends SqAbstractValue {
} }
export class SqNumberValue extends SqAbstractValue { export class SqNumberValue extends SqAbstractValue {
tag = Tag.SvtNumber as const; tag = Tag.Number as const;
get value() { get value() {
return valueMethod(this, RSValue.getNumber); return valueMethod(this, RSValue.getNumber);
@ -117,7 +117,7 @@ export class SqNumberValue extends SqAbstractValue {
} }
export class SqRecordValue extends SqAbstractValue { export class SqRecordValue extends SqAbstractValue {
tag = Tag.SvtRecord as const; tag = Tag.Record as const;
get value() { get value() {
return new SqRecord(valueMethod(this, RSValue.getRecord)); return new SqRecord(valueMethod(this, RSValue.getRecord));
@ -125,7 +125,7 @@ export class SqRecordValue extends SqAbstractValue {
} }
export class SqStringValue extends SqAbstractValue { export class SqStringValue extends SqAbstractValue {
tag = Tag.SvtString as const; tag = Tag.String as const;
get value(): string { get value(): string {
return valueMethod(this, RSValue.getString); return valueMethod(this, RSValue.getString);
@ -133,7 +133,7 @@ export class SqStringValue extends SqAbstractValue {
} }
export class SqSymbolValue extends SqAbstractValue { export class SqSymbolValue extends SqAbstractValue {
tag = Tag.SvtSymbol as const; tag = Tag.Symbol as const;
get value(): string { get value(): string {
return valueMethod(this, RSValue.getSymbol); return valueMethod(this, RSValue.getSymbol);
@ -141,7 +141,7 @@ export class SqSymbolValue extends SqAbstractValue {
} }
export class SqTimeDurationValue extends SqAbstractValue { export class SqTimeDurationValue extends SqAbstractValue {
tag = Tag.SvtTimeDuration as const; tag = Tag.TimeDuration as const;
get value() { get value() {
return valueMethod(this, RSValue.getTimeDuration); return valueMethod(this, RSValue.getTimeDuration);
@ -149,7 +149,7 @@ export class SqTimeDurationValue extends SqAbstractValue {
} }
export class SqTypeValue extends SqAbstractValue { export class SqTypeValue extends SqAbstractValue {
tag = Tag.SvtType as const; tag = Tag.Type as const;
get value() { get value() {
return new SqType(valueMethod(this, RSValue.getType)); return new SqType(valueMethod(this, RSValue.getType));
@ -157,7 +157,7 @@ export class SqTypeValue extends SqAbstractValue {
} }
export class SqTypeIdentifierValue extends SqAbstractValue { export class SqTypeIdentifierValue extends SqAbstractValue {
tag = Tag.SvtTypeIdentifier as const; tag = Tag.TypeIdentifier as const;
get value() { get value() {
return valueMethod(this, RSValue.getTypeIdentifier); return valueMethod(this, RSValue.getTypeIdentifier);
@ -165,27 +165,27 @@ export class SqTypeIdentifierValue extends SqAbstractValue {
} }
export class SqVoidValue extends SqAbstractValue { export class SqVoidValue extends SqAbstractValue {
tag = Tag.SvtVoid as const; tag = Tag.Void as const;
} }
const tagToClass = { const tagToClass = {
[Tag.SvtArray]: SqArrayValue, [Tag.Array]: SqArrayValue,
[Tag.SvtArrayString]: SqArrayStringValue, [Tag.ArrayString]: SqArrayStringValue,
[Tag.SvtBool]: SqBoolValue, [Tag.Bool]: SqBoolValue,
[Tag.SvtCall]: SqCallValue, [Tag.Call]: SqCallValue,
[Tag.SvtDate]: SqDateValue, [Tag.Date]: SqDateValue,
[Tag.SvtDeclaration]: SqDeclarationValue, [Tag.Declaration]: SqDeclarationValue,
[Tag.SvtDistribution]: SqDistributionValue, [Tag.Distribution]: SqDistributionValue,
[Tag.SvtLambda]: SqLambdaValue, [Tag.Lambda]: SqLambdaValue,
[Tag.SvtModule]: SqModuleValue, [Tag.Module]: SqModuleValue,
[Tag.SvtNumber]: SqNumberValue, [Tag.Number]: SqNumberValue,
[Tag.SvtRecord]: SqRecordValue, [Tag.Record]: SqRecordValue,
[Tag.SvtString]: SqStringValue, [Tag.String]: SqStringValue,
[Tag.SvtSymbol]: SqSymbolValue, [Tag.Symbol]: SqSymbolValue,
[Tag.SvtTimeDuration]: SqTimeDurationValue, [Tag.TimeDuration]: SqTimeDurationValue,
[Tag.SvtType]: SqTypeValue, [Tag.Type]: SqTypeValue,
[Tag.SvtTypeIdentifier]: SqTypeIdentifierValue, [Tag.TypeIdentifier]: SqTypeIdentifierValue,
[Tag.SvtVoid]: SqVoidValue, [Tag.Void]: SqVoidValue,
} as const; } as const;
// FIXME // FIXME

View File

@ -11,13 +11,13 @@ type environment = ForTS_Distribution_Environment.environment //use
let defaultEnvironment: environment = DistributionOperation.defaultEnv let defaultEnvironment: environment = DistributionOperation.defaultEnv
@module("./ForTS_Distribution_tag") @scope("distributionTag") @module("./ForTS_Distribution_tag") @scope("distributionTag")
external dtPointSet_: int = "DtPointSet" external dtPointSet_: int = "PointSet"
@module("./ForTS_Distribution_tag") @scope("distributionTag") @module("./ForTS_Distribution_tag") @scope("distributionTag")
external dtSampleSet_: int = "DtSampleSet" external dtSampleSet_: int = "SampleSet"
@module("./ForTS_Distribution_tag") @scope("distributionTag") @module("./ForTS_Distribution_tag") @scope("distributionTag")
external dtSymbolic_: int = "DtSymbolic" external dtSymbolic_: int = "Symbolic"
@genType.import("./ForTS_Distribution_tag") @genType.import("./ForTS_Distribution_tag")
type distributionTag type distributionTag

View File

@ -4,13 +4,13 @@
@genType type mixedShape = PointSetTypes.mixedShape @genType type mixedShape = PointSetTypes.mixedShape
@module("./ForTS_Distribution_PointSetDistribution_tag") @scope("pointSetDistributionTag") @module("./ForTS_Distribution_PointSetDistribution_tag") @scope("pointSetDistributionTag")
external pstMixed_: int = "PstMixed" external pstMixed_: int = "Mixed"
@module("./ForTS_Distribution_PointSetDistribution_tag") @scope("pointSetDistributionTag") @module("./ForTS_Distribution_PointSetDistribution_tag") @scope("pointSetDistributionTag")
external pstDiscrete_: int = "PstDiscrete" external pstDiscrete_: int = "Discrete"
@module("./ForTS_Distribution_PointSetDistribution_tag") @scope("pointSetDistributionTag") @module("./ForTS_Distribution_PointSetDistribution_tag") @scope("pointSetDistributionTag")
external pstContinuous_: int = "PstContinuous" external pstContinuous_: int = "Continuous"
@genType.import("./ForTS_Distribution_PointSetDistribution_tag") @genType.import("./ForTS_Distribution_PointSetDistribution_tag")
type pointSetDistributionTag type pointSetDistributionTag

View File

@ -1,5 +1,5 @@
export enum pointSetDistributionTag { export enum pointSetDistributionTag {
PstMixed, Mixed = "Mixed",
PstDiscrete, Discrete = "Discrete",
PstContinuous, Continuous = "Continuous",
} }

View File

@ -1,5 +1,5 @@
export enum distributionTag { export enum distributionTag {
DtPointSet, PointSet = "PointSet",
DtSampleSet, SampleSet = "SampleSet",
DtSymbolic, Symbolic = "Symbolic",
} }

View File

@ -12,55 +12,55 @@ type squiggleValue_Lambda = ForTS_SquiggleValue_Lambda.squiggleValue_Lambda //us
// Return values are kept as they are if they are JavaScript types. // Return values are kept as they are if they are JavaScript types.
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtArray_: string = "SvtArray" external svtArray_: string = "Array"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtArrayString_: string = "SvtArrayString" external svtArrayString_: string = "ArrayString"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtBool_: string = "SvtBool" external svtBool_: string = "Bool"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtCall_: string = "SvtCall" external svtCall_: string = "Call"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtDate_: string = "SvtDate" external svtDate_: string = "Date"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtDeclaration_: string = "SvtDeclaration" external svtDeclaration_: string = "Declaration"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtDistribution_: string = "SvtDistribution" external svtDistribution_: string = "Distribution"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtLambda_: string = "SvtLambda" external svtLambda_: string = "Lambda"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtModule_: string = "SvtModule" external svtModule_: string = "Module"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtNumber_: string = "SvtNumber" external svtNumber_: string = "Number"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtRecord_: string = "SvtRecord" external svtRecord_: string = "Record"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtString_: string = "SvtString" external svtString_: string = "String"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtSymbol_: string = "SvtSymbol" external svtSymbol_: string = "Symbol"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtTimeDuration_: string = "SvtTimeDuration" external svtTimeDuration_: string = "TimeDuration"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtType_: string = "SvtType" external svtType_: string = "Type"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtTypeIdentifier_: string = "SvtUndefined" external svtTypeIdentifier_: string = "TypeIdentifier"
@module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag") @module("./ForTS_SquiggleValue_tag") @scope("squiggleValueTag")
external svtVoid_: string = "SvtVoid" external svtVoid_: string = "Void"
@genType.import("./ForTS_SquiggleValue_tag") @genType.import("./ForTS_SquiggleValue_tag")
type squiggleValueTag type squiggleValueTag

View File

@ -1,19 +1,19 @@
export enum squiggleValueTag { export enum squiggleValueTag {
SvtArray = "Array", Array = "Array",
SvtArrayString = "ArrayString", ArrayString = "ArrayString",
SvtBool = "Bool", Bool = "Bool",
SvtCall = "Call", Call = "Call",
SvtDate = "Date", Date = "Date",
SvtDeclaration = "Declaration", Declaration = "Declaration",
SvtDistribution = "Distribution", Distribution = "Distribution",
SvtLambda = "Lambda", Lambda = "Lambda",
SvtModule = "Module", Module = "Module",
SvtNumber = "Number", Number = "Number",
SvtRecord = "Record", Record = "Record",
SvtString = "String", String = "String",
SvtSymbol = "Symbol", Symbol = "Symbol",
SvtTimeDuration = "TimeDuration", TimeDuration = "TimeDuration",
SvtType = "Type", Type = "Type",
SvtTypeIdentifier = "TypeIdentifier", TypeIdentifier = "TypeIdentifier",
SvtVoid = "Void", Void = "Void",
} }