[Haskell-cafe] Robert Harper on monads and laziness

Dominique Devriese dominique.devriese at cs.kuleuven.be
Mon May 2 14:29:08 CEST 2011


2011/5/2 Ketil Malde <ketil at malde.org>:
>  "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.  [...]
>
> 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?

I agree with your analysis. Throughout his different articles, I think
Harper partly has a point when he says that laziness brings certain
disadvantages (like e.g. complex memory and CPU behaviour) to Haskell
(although I disagree with some of his other  arguments here). However,
like you say, he misses the ball by amalgamating laziness with
referential transparency, where the first probably requires the second
but not vice versa. This allows him to simply dismiss both, which is
convenient for his apparent conclusion that "ML is strictly better
than Haskell", since referential transparency and purity are (in my
view) one of the things ML lacks most when compared to Haskell. His
only other argument against referential transparency and purity seems
to be his mentioning of "benign effects", which is weak for two
reasons: first, benign effects are clearly not what typical ML
programs use non-purity for and second, benign effects can be
supported much more conservatively using Haskell's unsafePerformIO.

Dominique



More information about the Haskell-Cafe mailing list