[commit: template-haskell] master: Abstract out a Ppr Inline instance (e6323fe)
Ian Lynagh
igloo at earth.li
Tue May 22 18:20:13 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/template-haskell
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/e6323fef1a67cf9d8e91ca35d71a9c89d2494413
>---------------------------------------------------------------
commit e6323fef1a67cf9d8e91ca35d71a9c89d2494413
Author: Ian Lynagh <igloo at earth.li>
Date: Tue May 22 15:41:40 2012 +0100
Abstract out a Ppr Inline instance
>---------------------------------------------------------------
Language/Haskell/TH/Ppr.hs | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/Language/Haskell/TH/Ppr.hs b/Language/Haskell/TH/Ppr.hs
index 89fd3df..8255f77 100644
--- a/Language/Haskell/TH/Ppr.hs
+++ b/Language/Haskell/TH/Ppr.hs
@@ -326,10 +326,7 @@ instance Ppr Foreign where
instance Ppr Pragma where
ppr (InlineP n (InlineSpec inline conlike activation))
= text "{-#"
- <+> text (case inline of
- NoInline -> "NOINLINE"
- Inline -> "INLINE"
- Inlinable -> "INLINABLE")
+ <+> ppr inline
<+> (if conlike then text "CONLIKE" else empty)
<+> ppr_activation activation
<+> ppr n
@@ -342,11 +339,7 @@ instance Ppr Pragma where
]
ppr (SpecialiseP n ty (Just (InlineSpec inline _conlike activation)))
= sep [ text "{-# SPECIALISE" <+>
- text (case inline of
- NoInline -> "NOINLINE"
- Inline -> "INLINE"
- Inlinable -> "INLINABLE") <+>
- ppr_activation activation
+ ppr inline <+> ppr_activation activation
, ppr n <+> text "::"
, ppr ty
, text "#-}"
@@ -359,6 +352,12 @@ ppr_activation (Just (beforeFrom, i))
ppr_activation Nothing = empty
------------------------------
+instance Ppr Inline where
+ ppr NoInline = text "NOINLINE"
+ ppr Inline = text "INLINE"
+ ppr Inlinable = text "INLINABLE"
+
+------------------------------
instance Ppr Clause where
ppr (Clause ps rhs ds) = hsep (map (pprPat appPrec) ps) <+> pprBody True rhs
$$ where_clause ds
More information about the Cvs-libraries
mailing list