\begin{code}
module FamInst (
- checkFamInstConsistency, tcExtendLocalFamInstEnv
+ checkFamInstConsistency, tcExtendLocalFamInstEnv, tcGetFamInstEnvs
) where
import HscTypes
import FamInstEnv
import TcMType
-import TcType
import TcRnMonad
import TyCon
import Name
import Module
import SrcLoc
import Outputable
-import LazyUniqFM
-import FiniteMap
+import UniqFM
import FastString
import Maybes
-import Monad
+import Control.Monad
+import Data.Map (Map)
+import qualified Data.Map as Map
\end{code}
-- Sets of module pairs
--
-type ModulePairSet = FiniteMap ModulePair ()
+type ModulePairSet = Map ModulePair ()
listToSet :: [ModulePair] -> ModulePairSet
-listToSet l = listToFM (zip l (repeat ()))
+listToSet l = Map.fromList (zip l (repeat ()))
checkFamInstConsistency :: [Module] -> [Module] -> TcM ()
checkFamInstConsistency famInstMods directlyImpMods
-- instances of okPairs are consistent
; criticalPairs = listToSet $ allPairs famInstMods
-- all pairs that we need to consider
- ; toCheckPairs = keysFM $ criticalPairs `minusFM` okPairs
+ ; toCheckPairs = Map.keys $ criticalPairs `Map.difference` okPairs
-- the difference gives us the pairs we need to check now
}
= setSrcSpan (mkSrcSpan loc loc) thing_inside
where
loc = getSrcLoc famInst
+\end{code}
+
+\begin{code}
+
+tcGetFamInstEnvs :: TcM (FamInstEnv, FamInstEnv)
+-- Gets both the external-package inst-env
+-- and the home-pkg inst env (includes module being compiled)
+tcGetFamInstEnvs
+ = do { eps <- getEps; env <- getGblEnv
+ ; return (eps_fam_inst_env eps, tcg_fam_inst_env env)
+ }
+
+
\end{code}