[Haskell-cafe] Robert Harper on monads and laziness
tonymorris at gmail.com
Tue May 3 02:14:29 CEST 2011
On 02/05/11 17:54, Ketil Malde wrote:
> 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/
Interesting how I have been authoring and subsequently using monads in
scala for several years and it is strictness that gets in the way more
I have been teaching functional programming for quite a while, both in
universities and outside of academia, and I am of the opinion that
Haskell's suitability in first place has no close second place. I wonder
why I am wrong, but this post (and previous) is hardly persuasive.
More information about the Haskell-Cafe