[Haskell-cafe] Martin Odersky on "What's wrong with Monads"
MightyByte
mightybyte at gmail.com
Mon Jun 25 23:51:32 CEST 2012
Jonathan Geddes <geddes.jonathan <at> gmail.com> writes:
> Cafe,
>
> I was watching a panel on languages[0] recently and Martin Odersky (the
creator of Scala) said something about Monads:
>
>
> "What's wrong with Monads is that if you go into a Monad you have to change
your whole syntax from scratch. Every single line of your program changes if you
get it in or out of a Monad. They're not polymorphic so it's really the old days
of Pascal. A monomorphic type system that says 'well that's all I do' ...
there's no way to abstract over things. " [0, 53:45]
>
>
> Thoughts?
In my mind, his first sentence could be paraphrased as follows:
"What's wrong with having a strongly typed mechanism for separating pure and
effectful code is that pure code and effectful code are actually separate."
Of course every line of your program that uses a Foo will change if you switch
to IO Foo instead. If the two were indistinguishable, then you'd have an impure
language instead of a pure one. Furthermore, this isn't a characteristic
specific to monads, it's the same for any type constructor whether it's a monad
or not.
To Martin's credit, earlier in the talk (around 45:15) he makes the following
statement:
"What you need in the language is the ability to essentially reduce state. And
potentially what Scala doesn't do, but for instance Haskell does is to control
state and purity, and I think that might be the next frontier."
Then at 50:15 he says, "So right now, I think...in the world of effect checking
we're about where we were with Pascal in terms of static typing."
It seems that his heart is in the right place, but he isn't aware of where we
actually are right now, and probably doesn't fully appreciate the consequences
of strongly typed purity.
More information about the Haskell-Cafe
mailing list