quotes pretty-printer not working as comments specify
I am currently working on a parser for GHC error messages, and would actually prefer that this remain unfixed, as this would make GHC error messages slightly harder to parse.
-- quotes encloses something in single quotes... -- but it omits them if the thing ends in a single quote -- so that we don't get `foo''. Instead we just have foo'. quotes d = SDoc $ \sty -> let pp_d = runSDoc d sty in case show pp_d of ('\'' : _) -> pp_d _other -> Pretty.quotes pp_d
This implementation does not match the comment - the code is checking for a leading single-quote, not for a trailing one. Therefore the following code does result in the
foo' :: (Show a) => a -> IO () foo' = print main = foo' print
Test.hs:3:8: No instance for (Show (a0 -> IO ())) arising from a use of `foo'' Possible fix: add an instance declaration for (Show (a0 -> IO ())) In the expression: foo' print In an equation for `main': main = foo' print