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

git at git.haskell.org git at git.haskell.org
Sat Oct 1 21:35:11 UTC 2016


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

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

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

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

    Add TRArrow pattern synonym


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

a05f387d3c6c160471829d50d26adf6e56e7504a
 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