4 ms·
I disagree with the sentiment that it's just a type. I understand that you don't need much plumbing, but you're still following a pattern that you have used el
by rtpg 10y ago
I disagree with the sentiment that it's just a type.
I understand that you don't need much plumbing, but you're still following a pattern that you have used elsewhere when working on these.
The beauty is that there's usually exactly one way of doing it (so by definition it is the simplest way). But if you're coming from a language based around mutability and are just in front of an Haskell REPL, I don't think you find this very easily.
In my mind patterns are about agreed-upon architectures for dealing with common issues. Another example that comes to mind in typed FP languages are wrapper types to prevent misuse of values (wrapping user input, unwrapping via "escape" calls).
When you have a problem, usually you'll have one or two canonical solutions come to mind. Those are the patterns for me.
Though given how simple everything usually is, it involves a lot less boilerplate. Choosing the right type is still essential.
- tome 10y agoRight, I don't really disagree with you, I think. It's just that I associate "pattern" with things that are "done by convention". By contrast the state monad is encoded in the language in Haskell rather than just "done by convention". On the other hand, I would say that your state monad in Python is a pattern, because there's no way of expressing the structure of the state monad in Python.