abount template haskell's pretty print: ($$$) x y = ...

PAF01143 at nifty.ne.jp PAF01143 at nifty.ne.jp
Tue Aug 27 02:27:54 CEST 2013


Hello. I'm Yoshikuni Jujo.
I want to correct ppr_dec of Language.Haskell.TH.Ppr.

Now:

ppr $ FunD (mkName "$$") [Clause [] (NormalB $ VarE $ mkName "x") []]
	=> $$ = x

but I want:

ppr $ FunD (mkName "$$") [Clause [] (NormalB $ VarE $ mkName "x") []]
	=> ($$) = x

I'll send patch.

--

module Language.Haskell.TH.Ppr

...

isOp :: String -> Bool
isOp = all (`elem` "!#$%&*+./<=>?@\\^|-~:")

ppr_dec _ (FunD f cs)
	| isOp $ nameBase f = vcat $ map (\c -> parens (ppr f) <+> ppr c) cs
	| otherwise = vcat ...
...
ppr_dec _ (SigD f t)
	| isOp $ nameBase f = parens (ppr f) <+> text "::" <+> ppr t
	| otherwise = ppr f ...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thPprFunDOp.patch
Type: text/x-diff
Size: 1261 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130827/16d523b2/attachment.patch>


More information about the ghc-devs mailing list