An error is raised with the command error. At any point, the code may decide to declare an error has occurred. Code execution halts at that point, and the call chain is unwound until the nearest enclosing error handler is found. This is all checked at compile time so errors cannot cause the whole program to crash.
They look like exceptions (try/catch), but they are not. Because you can't actually use exception as value which carries message.
You may be interested in how Pony handles errors
They look like exceptions (try/catch), but they are not. Because you can't actually use exception as value which carries message.
Also this maybe interesting (this is about Go): Rob Pike Reinvented Monads
In JS/TS we also have errors as values (idea copied from Monads in Haskell): io-ts.
You also might be interested in Either monad from fp-ts library.
@olexandrpopov, your Either link is broken, new url is:
rlee.dev/practical-guide-to-fp-ts-...
The import cost of this is insane. More code than an mui
Box
component!