Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> substitute error with whatever type you want there - null, Error, or your own thing

And if I want `error` to be `string` so I can just provide an error message? Proper disjoint sum types let me keep the two sides disjoint, even if they happen to be the same type. Union types will collapse on any overlap, so if I happen to instantiate `error` at `string` then I can no longer tell my error case from my data case.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: