
27 Jul
2008
27 Jul
'08
5:16 a.m.
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