On Tue, 15 Mar 2005, Nicola Whitehead wrote: (snip) > term :: Parser Int > term = do f <- factor > do symbol "*" > e <- expr > return (f * t) > +++ return f (snip)
> symbol and natural are defined elsewhere and work fine, but when I compile it > I get the error > > ERROR "C:/HUGS/Calculator.hs":66 - Undefined variable "t" > > I suspect I'm missing something obvious, but for the life of me I can't see > it. Any suggestions? (snip) You are missing something obvious. (-: "t" appears indeed to be undefined in "term". Did you mean "return (f * e)"? Variables (although why they're called that in Haskell I'm not sure) defined with <- in "do" are only in scope later in that "do", not anywhere else. Mark -- Haskell vacancies in Columbus, Ohio, USA: see http://www.aetion.com/jobs.html _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe