Ticket #8187: thPprFunDOp.patch

File thPprFunDOp.patch, 1.2 KB (added by YoshikuniJujo, 2 years ago)

git style patch

  • Language/Haskell/TH/Ppr.hs

    diff --git a/Language/Haskell/TH/Ppr.hs b/Language/Haskell/TH/Ppr.hs
    index 4096d9e..78d422a 100644
    a b instance Ppr Dec where 
    239239ppr_dec :: Bool     -- declaration on the toplevel?
    240240        -> Dec
    241241        -> Doc
    242 ppr_dec _ (FunD f cs)   = vcat $ map (\c -> ppr f <+> ppr c) cs
     242ppr_dec _ (FunD f cs)
     243  | isOp $ nameBase f = vcat $ map (\c -> parens (ppr f) <+> ppr c) cs
     244  | otherwise = vcat $ map (\c -> ppr f <+> ppr c) cs
     245  where
     246  isOp = all (`elem` "!#$%&*+./<=>?@\\^|-~:")
    243247ppr_dec _ (ValD p r ds) = ppr p <+> pprBody True r
    244248                          $$ where_clause ds
    245249ppr_dec _ (TySynD t xs rhs)
    ppr_dec _ (ClassD ctxt c xs fds ds) 
    253257    $$ where_clause ds
    254258ppr_dec _ (InstanceD ctxt i ds) = text "instance" <+> pprCxt ctxt <+> ppr i
    255259                                  $$ where_clause ds
    256 ppr_dec _ (SigD f t)    = ppr f <+> text "::" <+> ppr t
     260ppr_dec _ (SigD f t)
     261  | isOp $ nameBase f = parens (ppr f) <+> text "::" <+> ppr t
     262  | otherwise = ppr f <+> text "::" <+> ppr t
     263  where
     264  isOp = all (`elem` "!#$%&*+./<=>?@\\^|-~:")
    257265ppr_dec _ (ForeignD f)  = ppr f
    258266ppr_dec _ (InfixD fx n) = pprFixity n fx
    259267ppr_dec _ (PragmaD p)   = ppr p