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
@genType
type error =
| NotYetImplemented
| Unreachable
@ -27,7 +26,6 @@ module Error = {
let fromString = (s: string): t => OtherError(s)
@genType
let toString = (err: error): string =>
switch err {
| NotYetImplemented => "Function not yet implemented"

View File

@ -18,10 +18,14 @@ type squiggleValue_Declaration = ReducerInterface_InternalExpressionValue.lambda
@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.
// Exception: The intended type is really a JavaScript type or record. Not by coincidence
// Already existing open types we cannot dive in now
@genType type environment = GenericDist.env
@genType type squiggleValue_Distribution = DistributionTypes.genericDist
//TODO: index.ts should use types from here or vice versa

View File

@ -1,6 +1,4 @@
open ForTS__Types
/*
Global variables, functions, helpers, etc.
*/
@genType
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
type symbolicDist = SymbolicDistTypes.symbolicDist
@genType
type distributionError = DistributionTypes.error
@genType
type resultDist = result_<genericDist, distributionError>
@ -58,8 +55,9 @@ type discreteShape = PointSetTypes.discreteShape
@genType
type continuousShape = PointSetTypes.continuousShape
@genType
let distributionErrorToString = DistributionTypes.Error.toString
// ForTS_Distributions_Error.toString
// @genType
// let distributionErrorToString = DistributionTypes.Error.toString
@genType
let defaultSamplingEnv = DistributionOperation.defaultEnv