3 ms·
This is a good point and I agree it buys you similar safety. The annoying part is it isn’t a monadic data structure. You usually get some syntactic sugar for a
by klysm 4y ago
This is a good point and I agree it buys you similar safety. The annoying part is it isn’t a monadic data structure. You usually get some syntactic sugar for a limited subset of mapping (optional chaining), but a lot of the time that’s insufficient and you get imperative code.
- stiiv 4y agoSpeaking as someone who recently switched from F# to TypeScript: yes, "annoying" is just what it is. Until TypeScript at least has pattern matching you'll be writing at least 50% more code, maybe more. Chaining would be a godsend, but without auto-currying, it's unsightly. Computation expressions would be better, and would probably be easier to implement if, say, TypeScript included a "native" `Option`, `Result`, or `Async`.