[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] GHC rendering of non-ASCII characters configurable?
From:       Paolo Capriotti <p.capriotti () gmail ! com>
Date:       2012-07-30 9:02:09
Message-ID: CALMmMjYM9Asi_rAzuozswka4b1Sywf2az8wpz9K8YwvEFqEr9w () mail ! gmail ! com
[Download RAW message or body]

On Sun, Jul 29, 2012 at 7:04 PM, Richard Cobbe <cobbe@ccs.neu.edu> wrote:
> I'm working on an application that involves processing a lot of Unicode
> data, and I'm finding the built-in Show implementation for Char to be
> really inconvenient.  Specifically, it renders all characters at U+0080 and
> above with decimal escapes:
>
>     Prelude> '\x80'
>     '\128'
>
> This is annoying because all of the Unicode charts give the code points in
> hex, and indeed the charts are split into different PDFs at numbers that
> are nice and round in hex but not in decimal.  So in order to figure out
> which character I'm looking at, I have to convert back to hex and then look
> it up in the charts.
>
> Is there any way to ask GHC to render super-ASCII characters with their
> hexadecimal escapes, instead?  I'm perfectly happy to write my own custom
> Show instance, but I don't know how to hook that into ghci's REPL (or, for
> that matter, the routines that HUnit uses to generate the messages on
> failed tests, etc.).
>
> I'm using GHC 7.4.1 on MacOS 10.7.4.

In GHC HEAD there is a new flag -interactive-print that allows to
change the function used for printing values in GHCi. It will be in
7.6.1. That won't help with HUnit output, though.

BR,
Paolo

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic