[Haskell-cafe] Should "do 1" compile

Stefan Holdermans stefan at cs.uu.nl
Thu May 24 00:04:43 EDT 2007


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


More information about the Haskell-Cafe mailing list