
Thanks for the catching the typo. However, I keep getting type errors. The error that I get seems self-explanaotry, by telling me what to change the type to. But when I change it I get another error that seems to tell me to change it back. -----Original Message----- From: Philippa Cowderoy [mailto:flippa@flippac.org] Sent: Saturday, February 21, 2004 10:02 AM To: Matthew Morvant Subject: Re: [Haskell-cafe] More help for the newb On Sat, 21 Feb 2004, Matthew Morvant wrote:
36 code3 :: [b] -> [Char]
37 code3 = do{char '!'; digit; char 's'; many (do char 's'); return "Suc"} +++ do{char '%'; char 's'; digit; many (do digit): return "Suc"}
You appear to have a colon instead of a semicolon, which isn't good. Consider "many digit" rather than "many (do digit)", too. -- flippa@flippac.org

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
participants (2)
-
Matthew Morvant
-
Stefan Holdermans