
24 May
2007
24 May
'07
4:04 a.m.
Joshua,
Obviously this example is contrived, and you'd never want to use the list comprehension syntax for the IO monad. But you might want to for, say, the probability monad. Isn't that enough reason enough to decouple the sugar from the typing? (Though I agree with Claus that cryptic error messages are a bad thing.)
If I remember correctly, prior to Haskell 98, list comprehensions came in this general form, i.e., as monad comprehensions. I am not sure why they were restricted to lists, but I guess it had to do unresolved top-level overloading arising in a lot of programs that used monad comprehensions---and, hence, a lot of type annotations in a lot of run-of-the-mill comprehensions over lists. Cheers, Stefan