Rename Other to OtherError

This commit is contained in:
Sam Nolan 2022-04-23 14:13:38 -04:00
parent c7e601e15b
commit 7e8c16b923
4 changed files with 7 additions and 7 deletions

View File

@ -201,8 +201,8 @@ module Output = {
| (FromDist(fromDist), Dist(o)) => Ok(FromDist(fromDist, o)) | (FromDist(fromDist), Dist(o)) => Ok(FromDist(fromDist, o))
| (FromFloat(fromDist), Float(o)) => Ok(FromFloat(fromDist, o)) | (FromFloat(fromDist), Float(o)) => Ok(FromFloat(fromDist, o))
| (_, GenDistError(r)) => Error(r) | (_, GenDistError(r)) => Error(r)
| (FromDist(_), _) => Error(Other("Expected dist, got something else")) | (FromDist(_), _) => Error(OtherError("Expected dist, got something else"))
| (FromFloat(_), _) => Error(Other("Expected float, got something else")) | (FromFloat(_), _) => Error(OtherError("Expected float, got something else"))
} }
newFnCall->E.R2.fmap(run(~env))->OutputLocal.fromResult newFnCall->E.R2.fmap(run(~env))->OutputLocal.fromResult
} }

View File

@ -14,13 +14,13 @@ type error =
| OperationError(Operation.Error.invalidOperationError) | OperationError(Operation.Error.invalidOperationError)
| PointSetConversionError(SampleSetDist.pointsetConversionError) | PointSetConversionError(SampleSetDist.pointsetConversionError)
| SparklineError(PointSetTypes.sparklineError) // This type of error is for when we find a sparkline of a discrete distribution. This should probably at some point be actually implemented | SparklineError(PointSetTypes.sparklineError) // This type of error is for when we find a sparkline of a discrete distribution. This should probably at some point be actually implemented
| Other(string) | OtherError(string)
@genType @genType
module Error = { module Error = {
type t = error type t = error
let fromString = (s: string): t => Other(s) let fromString = (s: string): t => OtherError(s)
@genType @genType
let toString = (err: error): string => let toString = (err: error): string =>
@ -33,7 +33,7 @@ module Error = {
| OperationError(err) => Operation.Error.invalidOperationErrorToString(err) | OperationError(err) => Operation.Error.invalidOperationErrorToString(err)
| PointSetConversionError(err) => SampleSetDist.pointsetConversionErrorToString(err) | PointSetConversionError(err) => SampleSetDist.pointsetConversionErrorToString(err)
| SparklineError(err) => PointSetTypes.sparklineErrorToString(err) | SparklineError(err) => PointSetTypes.sparklineErrorToString(err)
| Other(s) => s | OtherError(s) => s
} }
let resultStringToResultError: result<'a, string> => result<'a, error> = n => let resultStringToResultError: result<'a, string> => result<'a, error> = n =>

View File

@ -284,7 +284,7 @@ let mixture = (
~pointwiseAddFn: pointwiseAddFn, ~pointwiseAddFn: pointwiseAddFn,
) => { ) => {
if E.A.length(values) == 0 { if E.A.length(values) == 0 {
Error(DistributionTypes.Other("Mixture error: mixture must have at least 1 element")) Error(DistributionTypes.OtherError("Mixture error: mixture must have at least 1 element"))
} else { } else {
let totalWeight = values->E.A2.fmap(E.Tuple2.second)->E.A.Floats.sum let totalWeight = values->E.A2.fmap(E.Tuple2.second)->E.A.Floats.sum
let properlyWeightedValues = let properlyWeightedValues =

View File

@ -172,7 +172,7 @@ module SymbolicConstructors = {
): option<DistributionOperation.outputType> => ): option<DistributionOperation.outputType> =>
switch symbolicResult { switch symbolicResult {
| Ok(r) => Some(Dist(Symbolic(r))) | Ok(r) => Some(Dist(Symbolic(r)))
| Error(r) => Some(GenDistError(Other(r))) | Error(r) => Some(GenDistError(OtherError(r)))
} }
} }