[commit: ghc] wip/merge: template-haskell: Missing instances for Rational and (). (10f9097)
git at git.haskell.org
git at git.haskell.org
Wed Nov 19 19:48:43 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/merge
Link : http://ghc.haskell.org/trac/ghc/changeset/10f90970375a53971593fb4dcf52b0242a78eaf8/ghc
>---------------------------------------------------------------
commit 10f90970375a53971593fb4dcf52b0242a78eaf8
Author: Mathieu Boespflug <m at tweag.io>
Date: Tue Nov 18 22:21:15 2014 -0600
template-haskell: Missing instances for Rational and ().
Test Plan: ./validate
Reviewers: austin
Reviewed By: austin
Subscribers: thomie, carter
Differential Revision: https://phabricator.haskell.org/D492
>---------------------------------------------------------------
10f90970375a53971593fb4dcf52b0242a78eaf8
docs/users_guide/7.10.1-notes.xml | 5 +++++
libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 11 +++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/docs/users_guide/7.10.1-notes.xml b/docs/users_guide/7.10.1-notes.xml
index 2e509e1..0cf3f61 100644
--- a/docs/users_guide/7.10.1-notes.xml
+++ b/docs/users_guide/7.10.1-notes.xml
@@ -176,6 +176,11 @@
Various features unsupported in quotations were previously
silently ignored. These now cause errors.
</para>
+
+ <para>
+ <literal>Lift</literal> instances were added for
+ <literal>()</literal> and <literal>Ratio</literal>.
+ </para>
</listitem>
</itemizedlist>
</sect3>
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index 48199a4..9813095 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP, DeriveDataTypeable, PolymorphicComponents,
- RoleAnnotations, DeriveGeneric #-}
+ RoleAnnotations, DeriveGeneric, TypeSynonymInstances,
+ FlexibleInstances #-}
-----------------------------------------------------------------------------
-- |
@@ -454,7 +455,10 @@ instance Lift Integer where
lift x = return (LitE (IntegerL x))
instance Lift Int where
- lift x= return (LitE (IntegerL (fromIntegral x)))
+ lift x = return (LitE (IntegerL (fromIntegral x)))
+
+instance Lift Rational where
+ lift x = return (LitE (RationalL x))
instance Lift Char where
lift x = return (LitE (CharL x))
@@ -478,6 +482,9 @@ liftString :: String -> Q Exp
-- Used in TcExpr to short-circuit the lifting for strings
liftString s = return (LitE (StringL s))
+instance Lift () where
+ lift () = return (ConE (tupleDataName 0))
+
instance (Lift a, Lift b) => Lift (a, b) where
lift (a, b)
= liftM TupE $ sequence [lift a, lift b]
More information about the ghc-commits
mailing list