[Haskell-beginners] Compilation error parsing arithmetic expressions with parsec-3.1.2

j.romildo at gmail.com j.romildo at gmail.com
Wed May 2 04:38:50 CEST 2012


Hello.

I want a parser to parse arithmetic expressions using
Parsec-3.1.2. Therefore I wrote the attached Haskell module.

But its compilation with ghc-7.4.1 fails with the message:


Expr1.hs:22:22:
    No instance for (Stream s0 m0 Char)
      arising from a use of `pLexeme'
    Possible fix: add an instance declaration for (Stream s0 m0 Char)
    In the second argument of `(<$>)', namely
      `pLexeme (many1 (satisfy isDigit))'
    In the expression: read <$> pLexeme (many1 (satisfy isDigit))
    In an equation for `pNum':
        pNum = read <$> pLexeme (many1 (satisfy isDigit))


Any clues on how to fix this?

Romildo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Expr1.hs
Type: text/x-haskell
Size: 579 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120501/0a241f3b/attachment.hs>


More information about the Beginners mailing list