Dubious behavior in TH pretty printer

Stefan O'Rear stefanor at cox.net
Mon Apr 2 04:12:35 EDT 2007


On Mon, Apr 02, 2007 at 09:02:41AM +0100, Simon Peyton-Jones wrote:
> | 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.)
> 
> Good plan.  You may find the function isSymOcc :: OccName -> Bool
> in OccName.lhs useful
> 
> Send us a patch, by all means.

I already sent a patch to the libraries list:
http://haskell.org/pipermail/libraries/2007-April/007317.html

This also fixes the printign of tilde-patterns.  (That said, a new
issue has been found - \ ((:) x xs) -> x pprs as \ (:) x xs -> x,
incorrectly parend.)

I didn't know about isSymOcc (indeed I never saw an OccName.lhs in
template-haskell); I implemented it myself with dropWhile and isAlpha. 

Stefan


More information about the Libraries mailing list