[GHC] #5509: quotes pretty-printer not working as comments specify

Malcolm Wallace malcolm.wallace at me.com
Tue Sep 27 11:06:13 CEST 2011


> From compiler/utils/Outputable.lhs
> {{{
> -- 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.

I was bitten by this bug the other day.  The code I was modifying had values called
    foo
    foo'
    foo''

and a type error message told me there was a fault with
   `foo''

so I ended up looking in entirely the wrong place for five minutes.

Regards,
    Malcolm




More information about the Glasgow-haskell-bugs mailing list