[Haskell-cafe] Robert Harper on monads and laziness
Manuel M T Chakravarty
chak at cse.unsw.edu.au
Tue May 3 07:32:08 CEST 2011
For a historical perspective, I highly recommend The Definitive Account of the History of Haskell:
Section 7 clearly and directly cites the desire to have pure I/O as the motivation for adopting monads. As you are saying that doesn't directly contradict the statement of Bob that you cite. In fact, Section 3.2 of the above paper supports the opinion that purity is a consequence of choosing to be lazy, but it also claims that the "combination of power and beauty" of a pure language motivated the language designers. Interestingly, today (at least the academic fraction of) the Haskell community appears to hold the purity of the language in higher regard than its laziness.
> I'm following Harper's blog, Existential Type¹, which I find to be an
> enjoyable and entertainingly written tirade about the advantages of
> teaching functional programming - specifically ML - to students. Of
> course, he tends to be critical of Haskell, but it's nice to get some
> thought provoking opinion from somebody who knows a bit about the
> Recently, he had a piece on monads, and how to do them in ML, and one
> statement puzzled me:
> "There is a particular reason why monads had to arise in Haskell,
> though, which is to defeat the scourge of laziness."
> My own view is/was that monads were so successful in Haskell since it
> allowed writing flexible programs with imperative features, without
> sacrificing referential transparency. Although people are quick (and
> rightly so) to point out that this flexibility goes way beyond IO, I
> think IO was in many ways the killer application for monads. Before IO,
> we had very limited functionality (like 'interact' taking a 'String ->
> String' function and converting it into an exectuable program) to build
> real programs from.
> Laziness does require referential transparency (or at least, it is
> easier to get away with the lack of RT in a strict language), so I can
> see that he is indirectly correct, but RT is a goal in itself. Thus, I
> wonder if there are any other rationale for a statement like that?
> ¹ http://existentialtype.wordpress.com/
> If I haven't seen further, it is by standing in the footprints of giants
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe