3 ms·
a tangent on the example of parsers that happened to be used: I found imperative mutable state made experimenting with different kinds of parsing algorithms tre
by hyp0 12y ago
a tangent on the example of parsers that happened to be used: I found imperative mutable state made experimenting with different kinds of parsing algorithms tremendously easier. You can just say what you mean. Now, I'm sure there is a way to express it with monads (that would be simpler to reason about and confirm for correctness etc), but the first problem for me, in experimenting with different approaches, was to get my ideas out of my head and into code, and get them to work at all.
If I was more skilled with monads, I might go directly to the ideal monadic solution... but I suspect I wouldn't have ideas that didn't fit well with monads in the first place. That is, (I fear) thinking in monads would restrict the breath of approaches that would come to mind... Disclaimer: because I'm not skilled in monads, I don't really know.
- tel 12y agoMonads make you be more clear than you might otherwise. Saying what you mean just means that you're used to the semantic space of your "standard imperative". This comes to play in parsers because a lot of their challenge is in properly piping around the recursive-backtracking state parts. Using monads you just create a semantic world where this recursive backtracking bit is built into the "nature" of state in your particular monad.