farrow icon indicating copy to clipboard operation
farrow copied to clipboard

errorhandling

Open StefanHoutzager opened this issue 4 years ago • 3 comments

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.

StefanHoutzager avatar Dec 26 '20 04:12 StefanHoutzager

Yeah, I have learned Haskell and Rust, but haven't seen the article above before.

Lucifier129 avatar Dec 26 '20 06:12 Lucifier129

To be honest, I tend to confuse errors and exceptions at work,but I think they are very different

uinz avatar Dec 26 '20 06:12 uinz

@uinz Maybe thinking with the inhabitants of type can help.

  • zero inhabitants type like Void or never or panic, means halt, no program can run.
  • 1 + a inhabitants type like Maybe in Haskell, or Option in Rust, encode the empty or defaults with a specific type
  • a + b inhabitants types like Either in Haskell, or Result in Rust, encode the union of two types.

Choice the appropriate one to model the problem we are facing in some domains.

Lucifier129 avatar Dec 26 '20 07:12 Lucifier129