3 ms·
Imagine writing a cooking recipe or any kind of instructions. They seem naturally sequential and an imperative to me. I can't imagine how a list of instructio
by homborg 2y ago
Imagine writing a cooking recipe or any kind of instructions.
They seem naturally sequential and an imperative to me.
I can't imagine how a list of instructions would be clearer in haskell.
- epgui 2y agoThat's an argument from incredulity... https://en.wikipedia.org/wiki/Argument_from_incredulity https://en.wikipedia.org/wiki/Argument_from_incredulity
- tome 2y agoI suppose I was looking for a more typical programming example than a cooking recipe, but even so I don't see why Haskell would have a problem there. I wouldn't claim it would be clearer but I still don't see why it would be worse. cook meat sauce = do pan <- getPan addTo pan meat cookFor pan 10 addTo pan sauce cookFor pan 3 food <- contents pan pure food
- epgui 2y ago> I wouldn't claim it would be clearer Although written in an imperative style and thus superficially similar, the haskell differs in that it is referentially transparent. I think that makes it objectively clearer, because it implies certain guarantees that nothing will surprise the reader.
- tome 2y agoThat's a good point! Python's weird scoping rules can make code very unclear.
- tasuki 2y agoMonads are exactly the mechanism for chaining instructions, how could it get any clearer than that?