3 ms·
I do agree most Haskell programmers don’t need to be authoring monads to be productive. My take was more along the lines that monads expose an interface/API to
by reikonomusha 5y ago
I do agree most Haskell programmers don’t need to be authoring monads to be productive. My take was more along the lines that monads expose an interface/API to the programmer that is used pervasively in “ordinary programming”. This interface/API is defined rather abstractly and doesn’t come equipped with “obvious”, self-evident definitions. You can get pretty far in Haskell though just sort of parroting these operators for specific class instances of interest, like IO and Maybe.
This is, I claim, unlike macros where you really don’t need to know about the machinery of macros (or even of their existence) to understand and use AND, OR, DOLIST, LOOP, etc. The notion of a macro doesn’t “leak” in “ordinary programming” whereas ‘>>=‘ or ‘return’ do, even if in just type errors.
(Sorry for the copious scare-quotes.)
- dwohnitmok 5y ago> This is, I claim, unlike macros where you really don’t need to know about the machinery of macros (or even of their existence) to understand and use AND, OR, DOLIST, LOOP, etc. Nah you do need to know about them, otherwise you won't understand a bunch of weird errors in your program (e.g. hmmmm... why does (reduce or my-collection) blow up?). I agree you don't need to know much about them. Really a novice Lisp programmer just needs to know, "don't use macros in anything that isn't a first-order construct, otherwise just treat it like a normal function," and that'll get them pretty far. But that's, as you say, really just the same difficulty as "sort of parroting these operators for specific class instances of interest, like IO and Maybe." And to understand one more level further down is really easy in both cases if you have any amount of hand-holding by an experienced mentor.
- bjoli 5y agoif you have an error with macros you can just expand them. Very few macros expand to more than 5-10 lines (loop being an exception).
- dwohnitmok 5y agoYes if you have problems with macros there are ways of debugging them. My point (in reply to reikonomusha) was simply that you do need to know about "the machinery of macros" and certainly their existence to do day-to-day programming in a Lisp.