26 ms·
This is a very old opinion, and one I don't think has aged terribly well. How old? Partway down the page there's a link called "new developments" that cites GHC
by andolanra 6y ago
This is a very old opinion, and one I don't think has aged terribly well. How old? Partway down the page there's a link called "new developments" that cites GHC 6.12, a version that came out in 2009!
Some thing it cites are still reasonably true, but others are complaints that reflect the Haskell of a different era. For example, it says, "Even more unfortunate, the applicative functors were introduced to Haskell's standard libraries only after monads and arrows, thus many types are instances of Monad and Arrow classes, but not as many are instances of Applicative." This has not been true for about half a decade, when Applicative was made a superclass of Monad. The article follows with: "There is no special syntax for applicative functors because it is hardly necessary." This is also no longer true, since the introduction of ApplicativeDo: even if you don't like it (and I confess I'm not a huge fan of ApplicativeDo myself!) it turns out that many people do find that sugar easier to write.
However, I think the key point I'd make is: all the advantages listed here of using monad without do-notation are real in some cases, but there's nothing stopping you from not using do-notation sporadically! Occasionally a snippet that uses do-notation can be made much clearer by using >>= or some other monadic function, and occasionally a snippet that uses >>= can be made much clearer by using do-notation, and I don't think there's anything inherently wrong with Haskell keeping both. To make a Python analogy: sometimes you can express a given construct more clearly with a loop than with a list comprehension, but I don't think that list comprehensions should be considered harmful: just use those tools when you need them, and don't use them when you don't need them!
- lynguist 6y agoYou are right. The title should have (2009) appended.
- jcelerier 6y ago> https://gitlab.haskell.org/ghc/ghc/-/wikis/applicative-do https://gitlab.haskell.org/ghc/ghc/-/wikis/applicative-do can't help but chuckle at the accomplishment of 40 years of research in functional PL, ending up with almost C-like syntax once again.
- saagarjha 6y agoLanguages always face a gentle tug towards what’s popular and familiar.
- ashtonkem 6y agoGentle seems to understate it, in my opinion.
- random314 6y agoSo much chuckling. I too can't help but chuckle at some of the substance less commentary at HN, where chuckling is a substitute for inability to contribute anything to a discussion.
- tasuki 6y agoYour comment is a little harsh.
- asdkjh345fd 6y agoI don't think it is harsh enough. The comment is devoid of substance and wrong.
- jcelerier 6y agocare to detail how do x <- a y <- b return (f x y) isn't basically imperative syntax ? hint: if you can get from it to C (or pascal or python or whatever) simply by adding a couple types, semicolons and replacing operators, it's C.
- lmm 6y agoHow is that any more or less imperative than the standard Haskell syntax: let x = a y = b in (f x y) ? Which in turn is very much like OCaml syntax or plenty of other functional syntaxes.
- Rerarom 6y agoI remember reading the Typeclassopedia nine years ago and feeling really annoyed (in an OCD way) that monad is not a subclass of applicative.
- exdsq 6y agoIsn't applicative relatively new, compared to monads? So it'd probably be quite a breaking change.
- Buttons840 6y agoMonad is now a subclass of Applicative.