[commit: ghc] master: template-haskell: Missing instances for Rational and (). (b3df5f6)
git at git.haskell.org
git at git.haskell.org
Wed Nov 19 23:03:19 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/b3df5f6b2562ffec4bb2fb486032903b8de5f475/ghc
>---------------------------------------------------------------
commit b3df5f6b2562ffec4bb2fb486032903b8de5f475
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
>---------------------------------------------------------------
b3df5f6b2562ffec4bb2fb486032903b8de5f475
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