diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Array.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Array.res index 61b84d74..cfe128e7 100644 --- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Array.res +++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Array.res @@ -4,3 +4,7 @@ type squiggleValue = ForTS_SquiggleValue.squiggleValue @genType let getValues = (v: squiggleValue_Array): array => ReducerInterface_InternalExpressionValue.arrayToValueArray(v) + +@genType +let toString = (v: squiggleValue_Array): string => + ReducerInterface_InternalExpressionValue.toStringArray(v) diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Declaration.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Declaration.res index b53fb4bf..7fe342f8 100644 --- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Declaration.res +++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Declaration.res @@ -1 +1,5 @@ @genType type squiggleValue_Declaration = ReducerInterface_InternalExpressionValue.lambdaDeclaration //re-export + +@genType +let toString = (v: squiggleValue_Declaration): string => + ReducerInterface_InternalExpressionValue.toStringDeclaration(v) diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Distribution.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Distribution.res index ef20d02f..c346701c 100644 --- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Distribution.res +++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Distribution.res @@ -1 +1,5 @@ @genType type squiggleValue_Distribution = ForTS_Distribution.distribution + +@genType +let toString = (v: squiggleValue_Distribution): string => + ReducerInterface_InternalExpressionValue.toStringDistribution(v) diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Lambda.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Lambda.res index c41a5727..5f14f5d3 100644 --- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Lambda.res +++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Lambda.res @@ -1 +1,5 @@ @genType type squiggleValue_Lambda = ReducerInterface_InternalExpressionValue.lambdaValue //re-export + +@genType +let toString = (v: squiggleValue_Lambda): string => + ReducerInterface_InternalExpressionValue.toStringLambda(v) diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Module.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Module.res index 8bb113a2..8125d1f3 100644 --- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Module.res +++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Module.res @@ -4,3 +4,7 @@ type squiggleValue = ForTS_SquiggleValue.squiggleValue //use @genType let getKeyValuePairs = (v: squiggleValue_Module): array<(string, squiggleValue)> => ReducerInterface_InternalExpressionValue.nameSpaceToKeyValuePairs(v) + +@genType +let toString = (v: squiggleValue_Module): string => + ReducerInterface_InternalExpressionValue.toStringNameSpace(v) diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Record.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Record.res index bc226f95..340abcfc 100644 --- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Record.res +++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Record.res @@ -4,3 +4,6 @@ type squiggleValue = ForTS_SquiggleValue.squiggleValue //use @genType let getKeyValuePairs = (value: squiggleValue_Record): array<(string, squiggleValue)> => ReducerInterface_InternalExpressionValue.recordToKeyValuePairs(value) + +@genType +let toString = (v: squiggleValue_Record) => ReducerInterface_InternalExpressionValue.toStringMap(v) diff --git a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Type.res b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Type.res index d9a18bfc..1399dcf4 100644 --- a/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Type.res +++ b/packages/squiggle-lang/src/rescript/ForTS/ForTS_SquiggleValue/ForTS_SquiggleValue_Type.res @@ -4,3 +4,7 @@ type squiggleValue = ForTS_SquiggleValue.squiggleValue //use @genType let getKeyValuePairs = (value: squiggleValue_Type): array<(string, squiggleValue)> => ReducerInterface_InternalExpressionValue.recordToKeyValuePairs(value) + +@genType +let toString = (value: squiggleValue_Type): string => + ReducerInterface_InternalExpressionValue.toStringType(value) diff --git a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_InternalExpressionValue.res b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_InternalExpressionValue.res index a31b0350..00d032bf 100644 --- a/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_InternalExpressionValue.res +++ b/packages/squiggle-lang/src/rescript/ReducerInterface/ReducerInterface_InternalExpressionValue.res @@ -41,7 +41,7 @@ type functionCall = (string, array) let rec toString = aValue => switch aValue { - | IEvArray(anArray) =>toStringArray(anArray) + | IEvArray(anArray) => toStringArray(anArray) | IEvArrayString(anArray) => toStringArrayString(anArray) | IEvBindings(m) => toStringBindings(m) | IEvBool(aBool) => toStringBool(aBool) @@ -59,27 +59,30 @@ let rec toString = aValue => | IEvTypeIdentifier(id) => toStringTypeIdentifier(id) | IEvVoid => toStringVoid } -and toStringArray = (anArray) => {let args = anArray->Js.Array2.map(each => toString(each))->Js.Array2.toString - `[${args}]`} -and toStringArrayString = (anArray) => { - let args = anArray->Js.Array2.toString - `[${args}]` - } -and toStringBindings = (m) => `@${m->toStringNameSpace}` -and toStringBool = (aBool) => Js.String.make(aBool) -and toStringCall = (fName) => `:${fName}` -and toStringDate = (date) => DateTime.Date.toString(date) -and toStringDeclaration = (d) => Declaration.toString(d, r => toString(IEvLambda(r))) -and toStringDistribution = (dist) => GenericDist.toString(dist) -and toStringLambda = (lambdaValue) => `lambda(${Js.Array2.toString(lambdaValue.parameters)}=>internal code)` -and toStringFunction = (lambdaValue) => `function(${Js.Array2.toString(lambdaValue.parameters)})` -and toStringNumber = (aNumber) => Js.String.make(aNumber) -and toStringRecord = (aMap) => aMap->toStringMap -and toStringString = (aString) => `'${aString}'` -and toStringSymbol = (aString) => `:${aString}` -and toStringTimeDuration = (t) => DateTime.Duration.toString(t) -and toStringType = (aMap) => aMap->toStringMap -and toStringTypeIdentifier = (id) => `#${id}` +and toStringArray = anArray => { + let args = anArray->Js.Array2.map(each => toString(each))->Js.Array2.toString + `[${args}]` +} +and toStringArrayString = anArray => { + let args = anArray->Js.Array2.toString + `[${args}]` +} +and toStringBindings = m => `@${m->toStringNameSpace}` +and toStringBool = aBool => Js.String.make(aBool) +and toStringCall = fName => `:${fName}` +and toStringDate = date => DateTime.Date.toString(date) +and toStringDeclaration = d => Declaration.toString(d, r => toString(IEvLambda(r))) +and toStringDistribution = dist => GenericDist.toString(dist) +and toStringLambda = lambdaValue => + `lambda(${Js.Array2.toString(lambdaValue.parameters)}=>internal code)` +and toStringFunction = lambdaValue => `function(${Js.Array2.toString(lambdaValue.parameters)})` +and toStringNumber = aNumber => Js.String.make(aNumber) +and toStringRecord = aMap => aMap->toStringMap +and toStringString = aString => `'${aString}'` +and toStringSymbol = aString => `:${aString}` +and toStringTimeDuration = t => DateTime.Duration.toString(t) +and toStringType = aMap => aMap->toStringMap +and toStringTypeIdentifier = id => `#${id}` and toStringVoid = `()` and toStringMap = aMap => {