[commit: ghc] master: Re-add 'classP' with a compatible implementation and a deprecation notice (4117551)

git at git.haskell.org git at git.haskell.org
Mon May 19 20:52:47 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/4117551f8822ff76501f9f96186dbd39dda26f1d/ghc

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

commit 4117551f8822ff76501f9f96186dbd39dda26f1d
Author: Gabor Greif <ggreif at gmail.com>
Date:   Wed May 14 23:41:50 2014 +0200

    Re-add 'classP' with a compatible implementation and a deprecation notice


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

4117551f8822ff76501f9f96186dbd39dda26f1d
 libraries/template-haskell/Language/Haskell/TH.hs     | 2 +-
 libraries/template-haskell/Language/Haskell/TH/Lib.hs | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libraries/template-haskell/Language/Haskell/TH.hs b/libraries/template-haskell/Language/Haskell/TH.hs
index e9765a9..916f101 100644
--- a/libraries/template-haskell/Language/Haskell/TH.hs
+++ b/libraries/template-haskell/Language/Haskell/TH.hs
@@ -112,7 +112,7 @@ module Language.Haskell.TH(
     -- **** Strictness
 	isStrict, notStrict, strictType, varStrictType,
     -- **** Class Contexts
-    cxt, normalC, recC, infixC, forallC,
+    cxt, classP, normalC, recC, infixC, forallC,
 
     -- *** Kinds
   varK, conK, tupleK, arrowK, listK, appK, starK, constraintK,
diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib.hs b/libraries/template-haskell/Language/Haskell/TH/Lib.hs
index 49baa96..08235ba 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Lib.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Lib.hs
@@ -526,6 +526,13 @@ sigT t k
 equalityT :: TypeQ
 equalityT = return EqualityT
 
+{-# DEPRECATED classP "Constraint constructors are just type constructors, frob this code as 'constraintT'." #-}
+classP :: Name -> [Q Type] -> Q Pred
+classP cla tys
+  = do
+      tysl <- sequence tys
+      return (foldl AppT (ConT cla) tysl)
+
 promotedT :: Name -> TypeQ
 promotedT = return . PromotedT
 



More information about the ghc-commits mailing list