[Haskell-cafe] More help for the newb

Stefan Holdermans sholderm at students.cs.uu.nl
Sat Feb 21 19:57:43 EST 2004


Matthew,

The last parts of your two do statements read 'return "Suc"':

  code3 = do { ... ; return "Suc" } +++ do { ... ; return "Suc" } .

Assuming that

  (+++) :: forall a . Parser a -> Parser a -> Parser a

the type for code3 will be inferenced as

  code3 :: Parser [Char] .

You annotated code3 as follows:

  code3 :: b -> [Char] .

>From this we would deduce

  type Parser a = forall b . b -> a .

However, then you would not have been able to declare Parser an instance of
Monad.

So, I think you should just change the type annotation on code3. ;)

HTH,

Stefan




More information about the Haskell-Cafe mailing list