opaque distribution type

This commit is contained in:
Umur Ozkul 2022-08-20 07:37:38 +02:00
parent feb7627ad0
commit 347c85324b
5 changed files with 13 additions and 11 deletions

View File

@ -6,7 +6,6 @@ type genericDist =
type asAlgebraicCombinationStrategy = AsDefault | AsSymbolic | AsMonteCarlo | AsConvolution type asAlgebraicCombinationStrategy = AsDefault | AsSymbolic | AsMonteCarlo | AsConvolution
@genType
type error = type error =
| NotYetImplemented | NotYetImplemented
| Unreachable | Unreachable
@ -27,7 +26,6 @@ module Error = {
let fromString = (s: string): t => OtherError(s) let fromString = (s: string): t => OtherError(s)
@genType
let toString = (err: error): string => let toString = (err: error): string =>
switch err { switch err {
| NotYetImplemented => "Function not yet implemented" | NotYetImplemented => "Function not yet implemented"

View File

@ -18,10 +18,14 @@ type squiggleValue_Declaration = ReducerInterface_InternalExpressionValue.lambda
@genType.opaque type reducerProject = ReducerProject_T.t @genType.opaque type reducerProject = ReducerProject_T.t
/* Distribution related */
@genType type environment = GenericDist.env
@genType.opaque
type distributionError = DistributionTypes.error
// From now on one should introduce any new types as opaque types. // From now on one should introduce any new types as opaque types.
// Exception: The intended type is really a JavaScript type or record. Not by coincidence // Exception: The intended type is really a JavaScript type or record. Not by coincidence
// Already existing open types we cannot dive in now // Already existing open types we cannot dive in now
@genType type environment = GenericDist.env
@genType type squiggleValue_Distribution = DistributionTypes.genericDist @genType type squiggleValue_Distribution = DistributionTypes.genericDist
//TODO: index.ts should use types from here or vice versa //TODO: index.ts should use types from here or vice versa

View File

@ -1,6 +1,4 @@
open ForTS__Types open ForTS__Types
/*
Global variables, functions, helpers, etc.
*/
@genType @genType
let defaultEnvironment: environment = DistributionOperation.defaultEnv let defaultEnvironment: environment = DistributionOperation.defaultEnv

View File

@ -0,0 +1,4 @@
open ForTS__Types
@genType
let toString = (e: distributionError) => DistributionTypes.Error.toString(e)

View File

@ -20,9 +20,6 @@ type sampleSetDist = SampleSetDist.t
@genType @genType
type symbolicDist = SymbolicDistTypes.symbolicDist type symbolicDist = SymbolicDistTypes.symbolicDist
@genType
type distributionError = DistributionTypes.error
@genType @genType
type resultDist = result_<genericDist, distributionError> type resultDist = result_<genericDist, distributionError>
@ -58,8 +55,9 @@ type discreteShape = PointSetTypes.discreteShape
@genType @genType
type continuousShape = PointSetTypes.continuousShape type continuousShape = PointSetTypes.continuousShape
@genType // ForTS_Distributions_Error.toString
let distributionErrorToString = DistributionTypes.Error.toString // @genType
// let distributionErrorToString = DistributionTypes.Error.toString
@genType @genType
let defaultSamplingEnv = DistributionOperation.defaultEnv let defaultSamplingEnv = DistributionOperation.defaultEnv