Thanks Simon.

In general I think multiline tuples should have many elements per line, but honestly the tuple case was a very specific example. If possible, I'd like to change the *overall* wrapping for *all* error messages - how does `sep` know when to break lines? there's clearly a numeric value for the number of columns somewhere, but where is it, and is it user-adjustable?

For now I am just hacking around this by special-casing some error messages and "un-doing" the line wrapping by parsing the messages and joining lines back together.

Thanks,
Andrew


On Mon, Jan 6, 2014 at 7:44 AM, Simon Peyton-Jones <simonpj@microsoft.com> wrote:

I think it’s line 705 in types/TypeRep.lhs

 

pprTcApp p pp tc tys

  | isTupleTyCon tc && tyConArity tc == length tys

  = pprPromotionQuote tc <>

    tupleParens (tupleTyConSort tc) (sep (punctuate comma (map (pp TopPrec) tys)))

 

If you change ‘sep’ to ‘fsep’, you’ll get behaviour more akin to paragraph-filling (hence the “f”).   Give it a try.  You’ll get validation failure from the testsuite, but you can see whether you think the result is better or worse.  In general, should multi-line tuples be printed with many elements per line, or just one?

 

Simon

 

From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of Andrew Gibiansky
Sent: 04 January 2014 17:30
To: Erik de Castro Lopo
Cc: ghc-devs@haskell.org
Subject: Re: Changing GHC Error Message Wrapping

 

Apologize for the broken image formatting.

 

With the code I posted above, I get the following output:

 

Couldn't match expected type `(GHC.Types.Int,

                               GHC.Types.Int,

                               GHC.Types.Int,

                               t0,

                               t10,

                               t20,

                               t30,

                               t40,

                               t50,

                               t60,

                               t70,

                               t80,

                               t90)'

            with actual type `(t1, t2, t3)'

 

I would like the types to be on the same line, or at least wrapped to a larger number of columns.

 

Does  anyone know how to do this, or where in the GHC source this wrapping is done?

 

Thanks!

Andrew

 

On Sat, Jan 4, 2014 at 2:55 AM, Erik de Castro Lopo <mle+hs@mega-nerd.com> wrote:

Carter Schonwald wrote:

> hey andrew, your image link isn't working (i'm using gmail)

I think the list software filters out image attachments.

Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/

_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs