[commit: ghc] wip/ttypeable: Add TRArrow pattern synonym (3bd60ba)
git at git.haskell.org
git at git.haskell.org
Sun Jan 29 20:19:00 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/ttypeable
Link : http://ghc.haskell.org/trac/ghc/changeset/3bd60ba48f68983c5f8df7e9732aaae1bf8c7184/ghc
>---------------------------------------------------------------
commit 3bd60ba48f68983c5f8df7e9732aaae1bf8c7184
Author: Ben Gamari <ben at smart-cactus.org>
Date: Sun Jul 10 10:51:33 2016 +0200
Add TRArrow pattern synonym
>---------------------------------------------------------------
3bd60ba48f68983c5f8df7e9732aaae1bf8c7184
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