farrow
farrow copied to clipboard
errorhandling
Interesting work. Have you looked into "type safe errorhandling"? For example https://dev.to/_gdelgado/type-safe-error-handling-in-typescript-1p4n explains it a bit.
Yeah, I have learned Haskell and Rust, but haven't seen the article above before.
To be honest, I tend to confuse errors and exceptions at work,but I think they are very different
@uinz Maybe thinking with the inhabitants of type can help.
zeroinhabitants type likeVoidorneverorpanic, means halt, no program can run.1 + ainhabitants type likeMaybeinHaskell, orOptioninRust, encode the empty or defaults with a specific typea + binhabitants types likeEitherinHaskell, orResultinRust, encode the union of two types.
Choice the appropriate one to model the problem we are facing in some domains.