Closed olynch closed 11 months ago
Currently we overload the type constructors for a GAT to check the validity of their arguments. Instead, we should have something like
checkvalidity(::typeof(Ob), x)
and then
Ob(x) = checkvalidity(Ob, x) ? x : throw(ValidationError(x))
We could also have checkvalidity return the reason why x is not valid, for better error messages.
checkvalidity
x
H/t @jpfairbanks for noticing that the way we were using the GAT type constructors was not Julia-idiomatic.
Currently we overload the type constructors for a GAT to check the validity of their arguments. Instead, we should have something like
checkvalidity(::typeof(Ob), x)
and then
Ob(x) = checkvalidity(Ob, x) ? x : throw(ValidationError(x))
We could also have
checkvalidity
return the reason whyx
is not valid, for better error messages.H/t @jpfairbanks for noticing that the way we were using the GAT type constructors was not Julia-idiomatic.