[Haskell-cafe] Parser problem continued

Nicola Whitehead nicolaw at unak.is
Tue Mar 15 10:28:44 EST 2005


Curiouser and curiouser...
 
expr :: Parser Int
expr = do t <- term
          do symbol "+"
             e <- expr
          return (t + e)
       +++ return t

solves the undefined variable problem but introduces a new 'Last operator in do {...} must be an expression' error, which then disappears if I explicitly return e
 
expr :: Parser Int
expr = do t <- term
          do symbol "+"
             e <- expr
             return e
          return (t + e)
       +++ return t

to give me the original undefined variable t error at the line expr = do t <- term . It looks in scope to me... :(
 
Thanks,
 
Nik
 
Dr Nik Freydís Whitehead
University of Akureyri, Iceland
*********************************************************************
Having the moral high ground is good.
Having the moral high ground and an FGMP-15 is better.
*********************************************************************
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/haskell-cafe/attachments/20050315/9f1aeb32/attachment.htm


More information about the Haskell-Cafe mailing list