projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a type synonym for FamInstEnvs
[ghc-hetmet.git]
/
compiler
/
types
/
FamInstEnv.lhs
diff --git
a/compiler/types/FamInstEnv.lhs
b/compiler/types/FamInstEnv.lhs
index
5ff0139
..
b851ec1
100644
(file)
--- a/
compiler/types/FamInstEnv.lhs
+++ b/
compiler/types/FamInstEnv.lhs
@@
-6,13
+6,15
@@
FamInstEnv: Type checked family instance declarations
\begin{code}
module FamInstEnv (
\begin{code}
module FamInstEnv (
- FamInst(..), famInstTyCon, pprFamInst, pprFamInstHdr, pprFamInsts,
+ FamInst(..), famInstTyCon, famInstTyVars,
+ pprFamInst, pprFamInstHdr, pprFamInsts,
famInstHead, mkLocalFamInst, mkImportedFamInst,
famInstHead, mkLocalFamInst, mkImportedFamInst,
- FamInstEnv, emptyFamInstEnv, extendFamInstEnv, extendFamInstEnvList,
+ FamInstEnvs, FamInstEnv, emptyFamInstEnv,
+ extendFamInstEnv, extendFamInstEnvList,
famInstEnvElts, familyInstances,
famInstEnvElts, familyInstances,
- lookupFamInstEnvExact, lookupFamInstEnv, lookupFamInstEnvUnify
+ lookupFamInstEnv, lookupFamInstEnvUnify
) where
#include "HsVersions.h"
) where
#include "HsVersions.h"
@@
-32,7
+34,6
@@
import UniqFM
import Outputable
import Maybe
import Outputable
import Maybe
-import Monad
\end{code}
\end{code}
@@
-60,6
+61,8
@@
data FamInst
--
famInstTyCon :: FamInst -> TyCon
famInstTyCon = fi_tycon
--
famInstTyCon :: FamInst -> TyCon
famInstTyCon = fi_tycon
+
+famInstTyVars = fi_tvs
\end{code}
\begin{code}
\end{code}
\begin{code}
@@
-140,6
+143,9
@@
InstEnv maps a family name to the list of known instances for that family.
\begin{code}
type FamInstEnv = UniqFM FamilyInstEnv -- Maps a family to its instances
\begin{code}
type FamInstEnv = UniqFM FamilyInstEnv -- Maps a family to its instances
+type FamInstEnvs = (FamInstEnv, FamInstEnv)
+ -- External package inst-env, Home-package inst-env
+
data FamilyInstEnv
= FamIE [FamInst] -- The instances for a particular family, in any order
Bool -- True <=> there is an instance of form T a b c
data FamilyInstEnv
= FamIE [FamInst] -- The instances for a particular family, in any order
Bool -- True <=> there is an instance of form T a b c
@@
-187,6
+193,7
@@
This is used when we want the @TyCon@ of a particular family instance (e.g.,
during deriving classes).
\begin{code}
during deriving classes).
\begin{code}
+{- NOT NEEDED ANY MORE
lookupFamInstEnvExact :: (FamInstEnv -- External package inst-env
,FamInstEnv) -- Home-package inst-env
-> TyCon -> [Type] -- What we are looking for
lookupFamInstEnvExact :: (FamInstEnv -- External package inst-env
,FamInstEnv) -- Home-package inst-env
-> TyCon -> [Type] -- What we are looking for
@@
-224,6
+231,7
@@
lookupFamInstEnvExact (pkg_ie, home_ie) fam tys
-- No match => try next
| otherwise
= find rest
-- No match => try next
| otherwise
= find rest
+-}
\end{code}
@lookupFamInstEnv@ looks up in a @FamInstEnv@, using a one-way match.
\end{code}
@lookupFamInstEnv@ looks up in a @FamInstEnv@, using a one-way match.
@@
-232,8
+240,7
@@
families), and then, it doesn't matter which match we choose (as the
instances are guaranteed confluent).
\begin{code}
instances are guaranteed confluent).
\begin{code}
-lookupFamInstEnv :: (FamInstEnv -- External package inst-env
- ,FamInstEnv) -- Home-package inst-env
+lookupFamInstEnv :: FamInstEnvs
-> TyCon -> [Type] -- What we are looking for
-> [(TvSubst, FamInst)] -- Successful matches
lookupFamInstEnv (pkg_ie, home_ie) fam tys
-> TyCon -> [Type] -- What we are looking for
-> [(TvSubst, FamInst)] -- Successful matches
lookupFamInstEnv (pkg_ie, home_ie) fam tys