|
|
|
|
|
by ux266478
286 days ago
|
|
> You're just going to unwrap that monad and promptly crash. It's unrecoverable You handle the error gracefully. It's not "unrecoverable" in the sense of an incorrect memory read that arises from a logic error in the program. It's an anticipatable behavior in a well-defined system of computations that should be treated as such. Simply crashing is extremely sloppy programming in this case, it's not a formal equivalent to discarding an unusable input. > No amount of static typing will turn this runtime error into a compile-time error On the contrary. Anything capable of statically checking dependent types can turn any runtime issue into a compile-time issue. Up to and including requiring proof that a function's domain is respected according to all paths that call it as a facet of the type system, and this domain can be inferred by the operations within the function itself. |
|
Does such a proof exist in this context? Or are we writing fanfiction about the problem domain now?
> It's not "unrecoverable"
Yes it is. The correct behaviour in that context is to terminate the program, which makes it unrecoverable.