[commit: ghc] type-nats-simple: Add a function to get all inert fun-eqs for the given tycon. (fb3f5d7)
git at git.haskell.org
git at git.haskell.org
Sun Sep 8 02:11:25 CEST 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : type-nats-simple
Link : http://ghc.haskell.org/trac/ghc/changeset/fb3f5d7db1fbd31b215befa4f5199a9dbd30d5d5/ghc
>---------------------------------------------------------------
commit fb3f5d7db1fbd31b215befa4f5199a9dbd30d5d5
Author: Iavor S. Diatchki <iavor.diatchki at gmail.com>
Date: Sat Sep 7 17:07:23 2013 -0700
Add a function to get all inert fun-eqs for the given tycon.
>---------------------------------------------------------------
fb3f5d7db1fbd31b215befa4f5199a9dbd30d5d5
compiler/typecheck/TcSMonad.lhs | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/compiler/typecheck/TcSMonad.lhs b/compiler/typecheck/TcSMonad.lhs
index 39337ad..d9fc9da 100644
--- a/compiler/typecheck/TcSMonad.lhs
+++ b/compiler/typecheck/TcSMonad.lhs
@@ -72,6 +72,7 @@ module TcSMonad (
modifyInertTcS,
insertInertItemTcS, partitionCCanMap, partitionEqMap,
getRelevantCts, extractRelevantInerts,
+ getInertsFunEqTyCon,
CCanMap(..), CtTypeMap, CtFamHeadMap, CtPredMap,
PredMap, FamHeadMap,
partCtFamHeadMap, lookupFamHead, lookupSolvedDict,
@@ -827,6 +828,18 @@ checkAllSolved
|| unsolved_dicts || unsolved_funeqs
|| not (isEmptyBag (inert_insols icans)))) }
+
+{- Get inert function equation constraints that have the given tycon
+in their head. Not that the constraints remain in the inert set.
+We use this to check for derived interactions with built-in type-function
+constructors. -}
+getInertsFunEqTyCon :: TyCon -> TcS [Ct]
+getInertsFunEqTyCon tc =
+ do is <- getTcSInerts
+ let mp = unFamHeadMap $ inert_funeqs $ inert_cans is
+ return $ lookupTypeMapTyCon mp tc
+
+
extractRelevantInerts :: Ct -> TcS Cts
-- Returns the constraints from the inert set that are 'relevant' to react with
-- this constraint. The monad is left with the 'thinner' inerts.
More information about the ghc-commits
mailing list