[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / compiler / uniType / AbsUniType.lhs
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1995
3 %
4 \section[AbsUniType]{@AbsUniType@: the abstract interface to @UniType@}
5
6 The module @AbsUniType@ is the ``outside world's'' interface to the
7 @UniType@ datatype.  It imports and re-exports the appropriate
8 @UniType@ stuff.
9
10 The prototype compiler's lack of original namery means it is good to
11 include @Class@, @TyVar@ and @TyCon@ stuff here, too, and to let this
12 module also present the ``outside-world'' interface for them.
13
14 \begin{code}
15 #include "HsVersions.h"
16
17 module AbsUniType (
18         -- Class and ClassOp stuff -------------------------------------
19         Class,
20         mkClass,
21         getClassKey, getClassOps,
22         getSuperDictSelId, getClassOpId, getDefaultMethodId,
23         getConstMethodId,
24         getClassSig, getClassBigSig, getClassInstEnv,
25 --UNUSED: getClassDefaultMethodsInfo,
26         isSuperClassOf,
27         cmpClass,
28         derivableClassKeys,
29         isNumericClass, isStandardClass, -- UNUSED: isDerivableClass,
30
31         ClassOp,
32         mkClassOp,
33         getClassOpTag, getClassOpString,
34 --UNUSED: getClassOpSig,
35         getClassOpLocalType,
36
37         -- TyVar stuff -------------------------------------------------
38         TyVar,
39         TyVarTemplate,
40
41         mkUserTyVar, mkPolySysTyVar, mkOpenSysTyVar,
42 --UNUSED: mkPrimSysTyVar, isPrimTyVar,
43
44 --      getTyVarUnique,
45
46         cmpTyVar, eqTyVar, ltTyVar,  -- used a lot!
47
48         mkUserTyVarTemplate, mkSysTyVarTemplate, mkTemplateTyVars, 
49
50         cloneTyVarFromTemplate,
51         cloneTyVar,
52         instantiateTyVarTemplates,
53
54         -- a supply of template tyvars 
55         alphaTyVars,
56         alpha_tv, beta_tv, gamma_tv, delta_tv, epsilon_tv,               -- templates
57         alpha_tyvar, beta_tyvar, gamma_tyvar, delta_tyvar, epsilon_tyvar,-- real tyvars
58
59         -- TyCon stuff -------------------------------------------------
60         TyCon,
61         Arity(..),      -- synonym for Int
62         mkSynonymTyCon, mkDataTyCon, mkTupleTyCon,
63         mkPrimTyCon, mkSpecTyCon,
64 #ifdef DPH
65         mkProcessorTyCon, mkPodizedPodTyCon,
66 #endif {- Data Parallel Haskell -}
67
68         isSynTyCon, isVisibleSynTyCon, isDataTyCon,
69         isPrimTyCon, isBoxedTyCon,
70         maybeCharLikeTyCon, maybeIntLikeTyCon,
71         maybeFloatLikeTyCon, maybeDoubleLikeTyCon,
72         isEnumerationTyCon, --UNUSED: isEnumerationTyConMostly,
73         isTupleTyCon,
74         isLocalSpecTyCon, isLocalGenTyCon, isBigTupleTyCon,
75         maybeSingleConstructorTyCon,
76         derivedFor, --UNUSED: preludeClassDerivedFor,
77         cmpTyCon, eqTyCon,
78
79         getTyConArity, getTyConDataCons,
80         getTyConTyVarTemplates,
81         getTyConKind,
82         getTyConDerivings,
83         getTyConFamilySize,
84
85         -- UniType stuff -----------------------------------------------
86         UniType,
87
88         -- USEFUL SYNONYMS
89         SigmaType(..), RhoType(..), TauType(..),
90         ThetaType(..),                  -- synonym for [(Class,UniType)]
91
92         -- CONSTRUCTION
93         mkTyVarTy, mkTyVarTemplateTy, mkDictTy,
94         -- use applyTyCon to make UniDatas, UniSyns
95         mkRhoTy, mkForallTy, mkSigmaTy, -- ToDo: perhaps nuke one?
96
97         -- QUANTIFICATION & INSTANTIATION
98         quantifyTy,
99         instantiateTy,  instantiateTauTy,  instantiateThetaTy,
100
101         -- COMPARISON (use sparingly!)
102         cmpUniType,
103         cmpUniTypeMaybeList,
104
105         -- PRE-BUILT TYPES (for Prelude)
106         alpha, beta, gamma, delta, epsilon,                     -- these have templates in them
107         alpha_ty, beta_ty, gamma_ty, delta_ty, epsilon_ty,      -- these have tyvars in them
108
109         -- UniTyFuns stuff ---------------------------------------------
110         -- CONSTRUCTION
111         applyTy, applyTyCon, applySynTyCon, applyNonSynTyCon,
112         glueTyArgs, mkSuperDictSelType, --UNUSED: mkDictFunType,
113         specialiseTy,
114
115         -- DESTRUCTION
116 --not exported: expandTySyns,
117         expandVisibleTySyn,
118         getTyVar, getTyVarMaybe, getTyVarTemplateMaybe,
119         splitType, splitForalls, getTauType, splitTyArgs,
120         splitTypeWithDictsAsArgs,
121 --not exported/unused:  sourceTypes, targetType,
122         funResultTy,
123         splitDictType,
124         kindFromType,
125         getUniDataTyCon, getUniDataTyCon_maybe,
126         getUniDataSpecTyCon, getUniDataSpecTyCon_maybe,
127         unDictifyTy,
128         getMentionedTyCons,
129 #ifdef USE_SEMANTIQUE_STRANAL
130         getReferredToTyCons,
131 #endif {- Semantique strictness analyser -}
132         getMentionedTyConsAndClassesFromUniType,
133         getMentionedTyConsAndClassesFromTyCon,
134         getMentionedTyConsAndClassesFromClass,
135         getUniTyDescription,
136
137         -- FREE-VARIABLE EXTRACTION
138         extractTyVarsFromTy, extractTyVarsFromTys,
139         extractTyVarTemplatesFromTy,
140
141         -- PREDICATES
142         isTyVarTy, isTyVarTemplateTy,
143         maybeUnpackFunTy, isFunType,
144         isPrimType, isUnboxedDataType, --UNUSED: isDataConType,
145         isLeakFreeType,
146         maybeBoxedPrimType,
147 --UNUSED: hasHigherOrderArg,
148         isDictTy, isGroundTy, isGroundOrTyVarTy,
149         instanceIsExported,
150 --UNUSED:       isSynTarget,
151         isTauTy, isForAllTy,
152         maybePurelyLocalTyCon, maybePurelyLocalClass,
153         maybePurelyLocalType,
154         returnsRealWorld, -- HACK courtesy of SLPJ
155 #ifdef DPH
156         isProcessorTy,
157         isProcessorTyCon,
158         isPodizedPodTyCon,
159         getPodizedPodDimension,
160         runtimeUnpodizableType,
161 #endif {- Data Parallel Haskell -}
162
163         -- SUBSTITUTION
164         applyTypeEnvToTy, applyTypeEnvToThetaTy,
165 --not exported: applyTypeEnvToTauTy,
166         mapOverTyVars,
167 --      genInstantiateTyUS, -- ToDo: ???
168
169         -- PRETTY PRINTING AND FORCING
170         pprUniType, pprParendUniType, pprMaybeTy,
171         pprTyCon, pprIfaceClass, pprClassOp,
172         getTypeString,
173         typeMaybeString,
174         specMaybeTysSuffix,
175         showTyCon,
176         showTypeCategory,
177
178         -- MATCHING
179         matchTy, -- UNUSED: matchTys,
180
181         -- and, finally, stuff to make the interface self-contained...
182 --      Outputable(..), NamedThing(..),
183         ExportFlag, Pretty(..), PprStyle, PrettyRep,
184
185         GlobalSwitch, UnfoldingDetails, Id, DataCon(..), IdEnv(..),
186         InstTemplate, Maybe, Name, FullName, ShortName,
187         PrimKind, TyVarEnv(..), TypeEnv(..), Unique, ClassInstEnv(..),
188         MatchEnv(..), InstTyEnv(..), UniqFM, Bag
189
190         IF_ATTACK_PRAGMAS(COMMA assocMaybe)
191
192 #ifndef __GLASGOW_HASKELL__
193         ,TAG_
194 #endif
195     ) where
196
197 import Class
198 import TyVar
199 import TyCon
200 import UniType
201 import UniTyFuns
202
203 import AbsSyn           ( RenamedBinds(..), RenamedExpr(..), RenamedGRHS(..),
204                           RenamedGRHSsAndBinds(..), RenamedPat(..), Binds,
205                           Expr, GRHS, GRHSsAndBinds, InPat
206                         )
207 import InstEnv          ( ClassInstEnv(..), MatchEnv(..) )
208 import Maybes           ( assocMaybe, Maybe(..) ) -- (..) for pragmas only
209 import NameTypes        ( ShortName, FullName ) -- pragmas only
210 import Outputable
211 import Pretty           ( Pretty(..)
212                           IF_ATTACK_PRAGMAS(COMMA ppStr COMMA ppDouble COMMA ppInteger)
213                         )
214 import TyVarEnv         -- ( TyVarEnv )
215 import Unique           ( Unique, UniqueSupply )
216 #if USE_ATTACK_PRAGMAS
217 import Util
218 #else
219 #ifndef __GLASGOW_HASKELL__
220 import Util             ( TAG_ )
221 #endif
222 #endif
223 \end{code}