parsec-3 problem

Roman Cheplyaka roma at ro-che.info
Sat Feb 19 10:27:28 CET 2011


* Christian Maeder <Christian.Maeder at dfki.de> [2011-02-18 13:27:53+0100]
> Hi,
> 
> the following code goes through parsec-2 (and parsec1) but is rejected
> by parsec-3
> 
>  import Text.ParserCombinators.Parsec
>  gqrrel = many1 (alphaNum <|> char '_')
>  myparser = sepBy gqrrel (char ',')
> 
> The error message is:
> 
>     No instance for (parsec-3.1.1:Text.Parsec.Prim.Stream s m Char)
>       arising from a use of `char' at P3.hs:3:25-32
>     Possible fix:
>       add an instance declaration for
>       (parsec-3.1.1:Text.Parsec.Prim.Stream s m Char)
>     In the second argument of `sepBy', namely `(char ',')'
>     In the expression: sepBy gqrrel (char ',')
>     In the definition of `myparser': myparser = sepBy gqrrel (char ',')

Works just fine here.

    % cat psc.hs                       
     import Text.ParserCombinators.Parsec
     gqrrel = many1 (alphaNum <|> char '_')
     myparser = sepBy gqrrel (char ',')

    % ghci -package parsec-3.1.0 psc.hs  
    GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
    Loading package ghc-prim ... linking ... done.
    Loading package integer-gmp ... linking ... done.
    Loading package base ... linking ... done.
    Loading package bytestring-0.9.1.5 ... linking ... done.
    Loading package mtl-1.1.0.2 ... linking ... done.
    Loading package syb-0.1.0.2 ... linking ... done.
    Loading package parsec-3.1.0 ... linking ... done.
    [1 of 1] Compiling Main             ( psc.hs, interpreted )
    Ok, modules loaded: Main.
    *Main> :t myparser 
    myparser
      :: (Text.Parsec.Prim.Stream s m Char) =>
         Text.Parsec.Prim.ParsecT s u m [[Char]]

-- 
Roman I. Cheplyaka :: http://ro-che.info/
Don't worry what people think, they don't do it very often.



More information about the Libraries mailing list