[Haskell-cafe] Martin Odersky on "What's wrong with Monads"
mightybyte at gmail.com
Thu Jun 28 17:03:22 CEST 2012
Tillmann Rendel <rendel <at> informatik.uni-marburg.de> writes:
> > Which drawbacks do you see besides increased verbosity?
> Well, you did change the equation "amount (Leaf x) = x" to "amount fun
> (Leaf x) = x". In a larger example, this means that you need to change
> many lines of many functions, just to get the the value of fun from the
> point where it is known to the point where you need it.
I would argue that no matter how good one's language is, there will always exist
realistic refactorings that require you to make sweeping changes to a large
portion of your code base.
> > [...] I am wondering which ways of doing this in Haskell you mean.
> I thought of the following three options, but see also Nathan Howells
> email for another alternative (that is related to my option (1) below):
> (1) Implicit parameters:
> (2) Lexical Scoping:
> (3) UnsafePerformIO:
> I'm not happy with any of these options. Personally, I would probably go
> ahead and transform the whole program just to get the value of fun to
> where it is needed. Nevertheless, having actually done this before, I
> understand why Martin Odersky doesn't like doing it :)
I think that Martin's statement is an unavoidable fact of life that follows
directly from the definition of purity and the mechanics of data dependencies.
Of course nobody likes making sweeping changes to their app because they didn't
anticipate the way the future would evolve. But lets not blame monads for what
is really a much more fundamental phenomenon.
More information about the Haskell-Cafe