[Haskell-cafe] Folded long string literals and CPP?

Viktor Dukhovni ietf-dane at dukhovni.org
Tue Nov 21 10:52:49 UTC 2023


On Tue, Nov 21, 2023 at 09:27:12AM +0000, Dan Dart wrote:

> That does sound like a bug. but it doesn't seem patchable using {-#
> LANGUAGE CPP #-} because it *is* a bug in -XCPP... :p
> 
> Have you reported it anywhere?

Not yet reported outside this thread.  Sure, morally speaking, this is a
bug in "-XCPP", but in practice "-XCPP" unavoidably uses the actual C
preprocessor, and is subject to its syntax idiosyncrasies.

There's not a lot GHC can do once CPP joins the split lines and drops
the trailing "\", and the documented trailing whitespace work-around no
longer (if it once did) helps.

So the only options appear to be to live with editing the code to to use
a trailing "\ \" instead of just "\" when enablng -XCPP (and reverting
when dropping "-XCPP", or else introduce a new syntax for multi-part
string literals.

Unless someone can suggest a better idea...

-- 
    Viktor.


More information about the Haskell-Cafe mailing list