Commit b3df5f6b authored by Mathieu Boespflug's avatar Mathieu Boespflug Committed by Austin Seipp
Browse files

template-haskell: Missing instances for Rational and ().

Test Plan: ./validate

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:
parent 7ef0971a
......@@ -176,6 +176,11 @@
Various features unsupported in quotations were previously
silently ignored. These now cause errors.
<literal>Lift</literal> instances were added for
<literal>()</literal> and <literal>Ratio</literal>.
{-# 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]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment