Improved error messages of function library
This commit is contained in:
parent
2aaa43008d
commit
a04761226d
|
@ -43,8 +43,7 @@ module Internal = {
|
||||||
|
|
||||||
let mapY = (pointSetDist: t, aLambdaValue, env, reducer) => {
|
let mapY = (pointSetDist: t, aLambdaValue, env, reducer) => {
|
||||||
let fn = r => doLambdaCall(aLambdaValue, list{IEvNumber(r)}, env, reducer)
|
let fn = r => doLambdaCall(aLambdaValue, list{IEvNumber(r)}, env, reducer)
|
||||||
let foo = PointSetDist.T.mapYResult(~fn, pointSetDist)
|
PointSetDist.T.mapYResult(~fn, pointSetDist)->toType
|
||||||
foo->toType
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +89,8 @@ let library = [
|
||||||
~inputs=[FRTypeDist, FRTypeLambda],
|
~inputs=[FRTypeDist, FRTypeLambda],
|
||||||
~run=(inputs, _, env, reducer) =>
|
~run=(inputs, _, env, reducer) =>
|
||||||
switch inputs {
|
switch inputs {
|
||||||
| [IEvDistribution(PointSet(dist)), IEvLambda(lambda)] => Internal.mapY(dist, lambda, env, reducer)->E.R2.errMap(_ => "")
|
| [IEvDistribution(PointSet(dist)), IEvLambda(lambda)] =>
|
||||||
|
Internal.mapY(dist, lambda, env, reducer)->E.R2.errMap(Reducer_ErrorValue.errorToString)
|
||||||
| _ => Error(impossibleError)
|
| _ => Error(impossibleError)
|
||||||
},
|
},
|
||||||
(),
|
(),
|
||||||
|
|
|
@ -92,7 +92,7 @@ let library = [
|
||||||
GenericDist.toSampleSetDist(dist, env.sampleCount)
|
GenericDist.toSampleSetDist(dist, env.sampleCount)
|
||||||
->E.R2.fmap(Wrappers.sampleSet)
|
->E.R2.fmap(Wrappers.sampleSet)
|
||||||
->E.R2.fmap(Wrappers.evDistribution)
|
->E.R2.fmap(Wrappers.evDistribution)
|
||||||
->E.R2.errMap(_ => "")
|
->E.R2.errMap(DistributionTypes.Error.toString)
|
||||||
| _ => Error(impossibleError)
|
| _ => Error(impossibleError)
|
||||||
},
|
},
|
||||||
(),
|
(),
|
||||||
|
@ -158,7 +158,7 @@ let library = [
|
||||||
| [IEvLambda(lambda)] =>
|
| [IEvLambda(lambda)] =>
|
||||||
switch Internal.fromFn(lambda, env, reducer) {
|
switch Internal.fromFn(lambda, env, reducer) {
|
||||||
| Ok(r) => Ok(r->Wrappers.sampleSet->Wrappers.evDistribution)
|
| Ok(r) => Ok(r->Wrappers.sampleSet->Wrappers.evDistribution)
|
||||||
| Error(_) => Error("issue")
|
| Error(e) => Error(Operation.Error.toString(e))
|
||||||
}
|
}
|
||||||
| _ => Error(impossibleError)
|
| _ => Error(impossibleError)
|
||||||
},
|
},
|
||||||
|
@ -180,7 +180,7 @@ let library = [
|
||||||
~run=(inputs, _, env, reducer) =>
|
~run=(inputs, _, env, reducer) =>
|
||||||
switch inputs {
|
switch inputs {
|
||||||
| [IEvDistribution(SampleSet(dist)), IEvLambda(lambda)] =>
|
| [IEvDistribution(SampleSet(dist)), IEvLambda(lambda)] =>
|
||||||
Internal.map1(dist, lambda, env, reducer)->E.R2.errMap(_ => "")
|
Internal.map1(dist, lambda, env, reducer)->E.R2.errMap(Reducer_ErrorValue.errorToString)
|
||||||
| _ => Error(impossibleError)
|
| _ => Error(impossibleError)
|
||||||
},
|
},
|
||||||
(),
|
(),
|
||||||
|
@ -207,7 +207,7 @@ let library = [
|
||||||
IEvDistribution(SampleSet(dist2)),
|
IEvDistribution(SampleSet(dist2)),
|
||||||
IEvLambda(lambda),
|
IEvLambda(lambda),
|
||||||
] =>
|
] =>
|
||||||
Internal.map2(dist1, dist2, lambda, env, reducer)->E.R2.errMap(_ => "")
|
Internal.map2(dist1, dist2, lambda, env, reducer)->E.R2.errMap(Reducer_ErrorValue.errorToString)
|
||||||
| _ => Error(impossibleError)
|
| _ => Error(impossibleError)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -236,7 +236,7 @@ let library = [
|
||||||
IEvDistribution(SampleSet(dist3)),
|
IEvDistribution(SampleSet(dist3)),
|
||||||
IEvLambda(lambda),
|
IEvLambda(lambda),
|
||||||
] =>
|
] =>
|
||||||
Internal.map3(dist1, dist2, dist3, lambda, env, reducer)->E.R2.errMap(_ => "")
|
Internal.map3(dist1, dist2, dist3, lambda, env, reducer)->E.R2.errMap(Reducer_ErrorValue.errorToString)
|
||||||
| _ => Error(impossibleError)
|
| _ => Error(impossibleError)
|
||||||
},
|
},
|
||||||
(),
|
(),
|
||||||
|
@ -259,9 +259,7 @@ let library = [
|
||||||
~run=(inputs, _, env, reducer) =>
|
~run=(inputs, _, env, reducer) =>
|
||||||
switch inputs {
|
switch inputs {
|
||||||
| [IEvArray(dists), IEvLambda(lambda)] =>
|
| [IEvArray(dists), IEvLambda(lambda)] =>
|
||||||
Internal.mapN(dists, lambda, env, reducer)->E.R2.errMap(_e => {
|
Internal.mapN(dists, lambda, env, reducer)->E.R2.errMap(Reducer_ErrorValue.errorToString)
|
||||||
"AHHH doesn't work"
|
|
||||||
})
|
|
||||||
| _ => Error(impossibleError)
|
| _ => Error(impossibleError)
|
||||||
},
|
},
|
||||||
(),
|
(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user