3 ms·
Main thing I dislike about errors as ADTs is it forces indentation in both cases. I miss go's "iff err..." otherwise continue as normal. Yes monads can allow th
by daxfohl 2y ago
Main thing I dislike about errors as ADTs is it forces indentation in both cases. I miss go's "iff err..." otherwise continue as normal. Yes monads can allow that, but they come with their own problems.
- Smaug123 2y agoAu contraire! You can unindent the final clause of an `if` or `match` block. Fantomas even supports it (`fsharp_experimental_keep_indent_in_branch = true`).
- daxfohl 2y agoOh, good to hear! My knowledge is about 7 years out of date at this point. I know typescript and mypy are pretty good at inferring which options of an ADT are impossible in various contexts and letting you do stuff like this, so great to hear F# has upped its game here too.