Dubious behavior in TH pretty printer
Stefan O'Rear
stefanor at cox.net
Sat Mar 31 04:00:06 EDT 2007
The Template Haskell pretty-printer handles infix/prefix distinction
improperly, causing text generated using it to be unparsable.
Example:
stefan at stefans:~/daanpp$ ghci -fth
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 6.7.20070323, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package base ... linking ... done.
Prelude> :m + Language.Haskell.TH
Prelude Language.Haskell.TH> runQ [| (+) 2 2 |] >>= print . ppr
Loading package template-haskell ... linking ... done.
GHC.Num.+ 2 2
I am trying to use the Template Haskell AST system for internal
representation of terms in a derivation library that can output
Haskell or feed directly into a splice. This "bug", unfixed, would
force me to fork the TH pretty printer. What would people think of a
patch changing the behavor to "Always produce parsable output"? (Yes,
I'm offering to implement it.)
Stefan
More information about the Libraries
mailing list