[Haskell-cafe] Should "do 1" compile

David House dmhouse at gmail.com
Wed May 23 14:00:40 EDT 2007


On 23/05/07, David House <dmhouse at gmail.com> wrote:
> Why should it compile? Expressions in a do-block have to have the type
> m a for some monad m, don't they?

Further developments on #haskell:

<SamB_XP> dmhouse: where in the report does it say that do blocks constrain
    types inherently?
<dmhouse> SamB_XP: I was under that impression, nothing more.
<SamB_XP> dmhouse: ah.
<SamB_XP> well, you would kind of think it would. but it looks like do is
    defined by translation, and like the Monad constraint only comes from >>
    and >>=
<dmhouse> SamB_XP: right, so do (1 :: Int); (2 :: Int) is illegal as it
    doesn't match the type of (>>), but do (1 :: Int) isn't?
<SamB_XP> dmhouse: so it would seem

-- 
-David House, dmhouse at gmail.com


More information about the Haskell-Cafe mailing list