[commit: ghc] wip/T10832-generalised-injectivity: Wibbles in TH (d822e28)

git at git.haskell.org git at git.haskell.org
Thu Dec 24 15:09:54 UTC 2015


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

On branch  : wip/T10832-generalised-injectivity
Link       : http://ghc.haskell.org/trac/ghc/changeset/d822e2879db15f1ebd5b8aed756f1609c17969b6/ghc

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

commit d822e2879db15f1ebd5b8aed756f1609c17969b6
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Dec 24 15:10:35 2015 +0000

    Wibbles in TH


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

d822e2879db15f1ebd5b8aed756f1609c17969b6
 libraries/template-haskell/Language/Haskell/TH/Lib.hs | 12 ++++++------
 libraries/template-haskell/Language/Haskell/TH/Ppr.hs |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib.hs b/libraries/template-haskell/Language/Haskell/TH/Lib.hs
index 886e8bd..a2d26d2 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Lib.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Lib.hs
@@ -461,12 +461,12 @@ dataFamilyD tc tvs kind
     = return $ DataFamilyD tc tvs kind
 
 openTypeFamilyD :: Name -> [TyVarBndr] -> FamilyResultSig
-                -> Maybe InjectivityAnn -> DecQ
+                -> InjectivityAnn -> DecQ
 openTypeFamilyD tc tvs res inj
     = return $ OpenTypeFamilyD (TypeFamilyHead tc tvs res inj)
 
 closedTypeFamilyD :: Name -> [TyVarBndr] -> FamilyResultSig
-                  -> Maybe InjectivityAnn -> [TySynEqnQ] -> DecQ
+                  -> InjectivityAnn -> [TySynEqnQ] -> DecQ
 closedTypeFamilyD tc tvs result injectivity eqns =
   do eqns1 <- sequence eqns
      return (ClosedTypeFamilyD (TypeFamilyHead tc tvs result injectivity) eqns1)
@@ -487,14 +487,14 @@ closedTypeFamilyD tc tvs result injectivity eqns =
 familyNoKindD :: FamFlavour -> Name -> [TyVarBndr] -> DecQ
 familyNoKindD flav tc tvs =
     case flav of
-      TypeFam -> return $ OpenTypeFamilyD (TypeFamilyHead tc tvs NoSig Nothing)
+      TypeFam -> return $ OpenTypeFamilyD (TypeFamilyHead tc tvs NoSig [])
       DataFam -> return $ DataFamilyD tc tvs Nothing
 
 familyKindD :: FamFlavour -> Name -> [TyVarBndr] -> Kind -> DecQ
 familyKindD flav tc tvs k =
     case flav of
       TypeFam ->
-        return $ OpenTypeFamilyD (TypeFamilyHead tc tvs (KindSig k) Nothing)
+        return $ OpenTypeFamilyD (TypeFamilyHead tc tvs (KindSig k) [])
       DataFam -> return $ DataFamilyD tc tvs (Just k)
 
 {-# DEPRECATED closedTypeFamilyNoKindD, closedTypeFamilyKindD
@@ -502,12 +502,12 @@ familyKindD flav tc tvs k =
 closedTypeFamilyNoKindD :: Name -> [TyVarBndr] -> [TySynEqnQ] -> DecQ
 closedTypeFamilyNoKindD tc tvs eqns =
  do eqns1 <- sequence eqns
-    return (ClosedTypeFamilyD (TypeFamilyHead tc tvs NoSig Nothing) eqns1)
+    return (ClosedTypeFamilyD (TypeFamilyHead tc tvs NoSig []) eqns1)
 
 closedTypeFamilyKindD :: Name -> [TyVarBndr] -> Kind -> [TySynEqnQ] -> DecQ
 closedTypeFamilyKindD tc tvs kind eqns =
  do eqns1 <- sequence eqns
-    return (ClosedTypeFamilyD (TypeFamilyHead tc tvs (KindSig kind) Nothing)
+    return (ClosedTypeFamilyD (TypeFamilyHead tc tvs (KindSig kind) [])
             eqns1)
 
 roleAnnotD :: Name -> [Role] -> DecQ
diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
index f74c997..040669e 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
@@ -393,8 +393,8 @@ ppr_tf_head :: TypeFamilyHead -> Doc
 ppr_tf_head (TypeFamilyHead tc tvs res inj)
   = ppr tc <+> hsep (map ppr tvs) <+> ppr res <+> maybeInj
   where
-    maybeInj | (Just inj') <- inj = ppr inj'
-             | otherwise          = empty
+    maybeInj | null inj  = empty
+             | otherwise = ppr inj
 
 ------------------------------
 instance Ppr FunDep where



More information about the ghc-commits mailing list