darcs patch: Fix Unicode bug in haskell-src

Don Stewart dons at galois.com
Wed Jul 30 17:59:44 EDT 2008


Looks good to me. Ian, do you want to apply this?

sanzhiyan:
>    Language.Haskell.Parser currently can't parse modules with unicode symbols
>    in operators, which are allowed by the haskell98 standard.
>    The attached patch is a small change in the lexer code to fix this.
>    Since parseModule expects a String of Unicode codepoints as usual,
>    examples/hsparser.hs will still raise errors on modules that use unicode,
>    because it doesn't decode the source.
>    The correct behaviour, assuming an utf-8 source, can be tested like this:
> 
>    > import System.IO.UTF8 as U -- from utf8-string
>    > import Language.Haskell.Parser
>    > import Language.Haskell.Pretty
>    > main = do file <- U.readFile "module.hs"
>    >           case parseModule of
>    >                ParseOk m   -> U.putStrLn (prettyPrint m)
>    >                e@(ParseError _ _) = print e


> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries



More information about the Libraries mailing list