Thanks, I'd thought it was something to do with incompatible types. I can now 
create a simpler problem:

tester2 = reserved "parameter" <|> symbol ":"

Certainly I could use reserved ":" instead of symbol, but where is my thinking 
with symbol here going wrong? Surely the above example isn't so odd?

Paul


-----Original Message-----
From: Luke Palmer [mailto:[EMAIL PROTECTED]
Sent: Fri 3/28/2008 12:26 AM
To: Paul Keir
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Parsec Expected Type
 
Hi Paul,

2008/3/27 Paul Keir <[EMAIL PROTECTED]>:
> Hi,
>
>  Does anyone know why this reduced Parsec production stops compilation, and
> how I can fix it?
>
>  tester = reserved "parameter"
>       <|> do { reserved "dimension"; symbol ":" }

Look at the types of "reserved" and "symbol" (from
http://www.haskell.org/ghc/docs/latest/html/libraries/parsec/Text-ParserCombinators-Parsec-Token.html):

  symbol :: String -> CharParser st String
  reserved :: String -> CharParser st ()

The type of a do block is the same as the type of its last statement.
But (reserved "parameter") and (symbol ";") do not have the same type.

Luke

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to