[commit: ghc] wip/rae: Merge some instances from th-orphans. (830989a)

git at git.haskell.org git at git.haskell.org
Thu Dec 18 04:33:25 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/rae
Link       : http://ghc.haskell.org/trac/ghc/changeset/830989a17071b7d594ea6a72ac680f093e386974/ghc

>---------------------------------------------------------------

commit 830989a17071b7d594ea6a72ac680f093e386974
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date:   Tue Dec 16 17:17:06 2014 -0500

    Merge some instances from th-orphans.


>---------------------------------------------------------------

830989a17071b7d594ea6a72ac680f093e386974
 libraries/template-haskell/Language/Haskell/TH/Ppr.hs    | 14 ++++++++++++++
 libraries/template-haskell/Language/Haskell/TH/Syntax.hs |  3 +++
 2 files changed, 17 insertions(+)

diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
index 0f828eb..63fa80b 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
@@ -211,6 +211,9 @@ pprBody eq body = case body of
               | otherwise = arrow
 
 ------------------------------
+instance Ppr Lit where
+  ppr = pprLit noPrec
+
 pprLit :: Precedence -> Lit -> Doc
 pprLit i (IntPrimL x)    = parensIf (i > noPrec && x < 0)
                                     (integer x <> char '#')
@@ -576,3 +579,14 @@ hashParens d = text "(# " <> d <> text " #)"
 
 quoteParens :: Doc -> Doc
 quoteParens d = text "'(" <> d <> text ")"
+
+-----------------------------
+instance Ppr Loc where
+  ppr (Loc { loc_module = mod
+           , loc_package = pkg
+           , loc_start = (start_ln, start_col)
+           , loc_end = (end_ln, end_col) })
+    = hcat [ text pkg, colon, text mod, colon
+           , parens $ int start_ln <> comma <> int start_col
+           , text "-"
+           , parens $ int end_ln <> comma <> int end_col ]
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index 3634ef7..abdde2d 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -457,6 +457,9 @@ instance Lift Integer where
 instance Lift Int where
   lift x = return (LitE (IntegerL (fromIntegral x)))
 
+instance Lift Word8 where
+  lift x = return (LitE (IntegerL (fromIntegral x)))
+
 instance Lift Rational where
   lift x = return (LitE (RationalL x))
 



More information about the ghc-commits mailing list