3 ms·
I think you are missing the biggest advantage of F#: computation expressions. Computation expressions are like do-notation and list comprehensions in one featu
by dfgdghdf 6y ago
I think you are missing the biggest advantage of F#: computation expressions.
Computation expressions are like do-notation and list comprehensions in one feature. Now that I have tried them, I don't want to go back to a language without!
- KurtMueller 6y agoComputation expressions seem like one of F#'s unique features. I assume there are corollaries in other languages - but damn do they make code readable.
- jordwest 6y agoOh yes! These are amazing. Took me a while to understand what they do, but now the simplest way I think of it is that they're powerful enough to let you build your own async/await (though you don't need to - async await computation expressions are already included)
- galaxyLogic 6y agoInteresting. But is it true that that is nothing like that in other languages?
- dfgdghdf 6y agoThey are a bit like do-notation in Haskell, but with a few extra things. They are also like a more restricted / opinionated version of Clojure macros. What's really cool is that things like ```async function *``` from JS can be implemented as libraries in F#.
- nsonha 6y agoThis is just monadic bind, every functional language has this
- drs444 6y agoF# computation expressions go well beyond notation for monadic bind, see the section in https://fsharp.org/history https://fsharp.org/history or other technical descriptions.