[commit: ghc] wip/ttypeable: Add TRArrow pattern synonym (f03c84a)

git at git.haskell.org git at git.haskell.org
Fri Jul 29 16:28:51 UTC 2016


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

On branch  : wip/ttypeable
Link       : http://ghc.haskell.org/trac/ghc/changeset/f03c84a652cb7e0a4269b3ab7d4ff4fb48ac87ef/ghc

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

commit f03c84a652cb7e0a4269b3ab7d4ff4fb48ac87ef
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sun Jul 10 10:51:33 2016 +0200

    Add TRArrow pattern synonym


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

f03c84a652cb7e0a4269b3ab7d4ff4fb48ac87ef
 libraries/base/Data/Typeable/Internal.hs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs
index 8213c12..702616f 100644
--- a/libraries/base/Data/Typeable/Internal.hs
+++ b/libraries/base/Data/Typeable/Internal.hs
@@ -186,13 +186,17 @@ instance Ord TypeRepX where
   TypeRepX a `compare` TypeRepX b =
     typeRepFingerprint a `compare` typeRepFingerprint b
 
+--pattern TRArrow :: TypeRep (->)
+pattern TRArrow <- (eqTypeRep trArrow -> Just HRefl)
+  where TRArrow = trArrow
+
 pattern TRFun :: forall fun. ()
               => forall arg res. (fun ~ (arg -> res))
               => TypeRep arg
               -> TypeRep res
               -> TypeRep fun
-pattern TRFun arg res <- TrApp _ (TrApp _ (eqTypeRep trArrow -> Just HRefl) arg) res where
-  TRFun arg res = mkTrApp (mkTrApp trArrow arg) res
+pattern TRFun arg res <- TRApp (TRApp TRArrow arg) res
+  where TRFun arg res = mkTrApp (mkTrApp trArrow arg) res
 
 decomposeFun :: forall fun r.
                 TypeRep fun



More information about the ghc-commits mailing list