Closed axch closed 1 year ago
I think the blocking problem is that simplify tries to turn a ThrowException (Atom CoreIR)
into a ThrowException (Atom SimpIR)
which is detected by exceptToMaybeExpr
later. The Atom
represents the type that the throw
doesn't return (not the type of the exception itself, which is Unit); and if that type is functional, it can't be represented as a Atom SimpIR
.
Note: The same example breaks with error
as well as throw
.
We discussed this offline. Ideally error
and throw
should work with non-data return types but the current compiler doesn't handle them. Fixing that is one todo among many, and in the meantime it's better to have a type error than a compiler crash. So let's add the Data
constraint for now, with the intention of eventually removing it. We can keep this issue open to track it.
I added the Data
constraints in #1235 . I'll open a separate feature request to relax this constraint.
Expected
Nothing
(of typeMaybe Float
).