PrelNames.lhs 39.4 KB
Newer Older
1
2
3
%
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
4
5
6
\section[PrelNames]{Definitions of prelude modules and names}


7
Nota Bene: all Names defined in here should come from the base package
8

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
* ModuleNames for prelude modules, 
	e.g.	pREL_BASE_Name :: ModuleName

* Modules for prelude modules
	e.g.	pREL_Base :: Module

* Uniques for Ids, DataCons, TyCons and Classes that the compiler 
  "knows about" in some way
	e.g.	intTyConKey :: Unique
		minusClassOpKey :: Unique

* Names for Ids, DataCons, TyCons and Classes that the compiler 
  "knows about" in some way
	e.g.	intTyConName :: Name
		minusName    :: Name
  One of these Names contains
	(a) the module and occurrence name of the thing
	(b) its Unique
  The may way the compiler "knows about" one of these things is
  where the type checker or desugarer needs to look it up. For
  example, when desugaring list comprehensions the desugarer
  needs to conjure up 'foldr'.  It does this by looking up
  foldrName in the environment.

* RdrNames for Ids, DataCons etc that the compiler may emit into
  generated code (e.g. for deriving).  It's not necessary to know
  the uniques for these guys, only their names

37
38

\begin{code}
39
40
module PrelNames (
	Unique, Uniquable(..), hasKey, 	-- Re-exported for convenience
41

42
	-----------------------------------------------------------
43
44
	module PrelNames,	-- A huge bunch of (a) Names,  e.g. intTyConName
				--		   (b) Uniques e.g. intTyConKey
45
46
				--		   (c) Groups of classes and types
				--		   (d) miscellaneous things
47
				-- So many that we export them all
48
    ) where
49
50
51

#include "HsVersions.h"

52
53
import Module	  ( Module, mkBasePkgModule, mkHomeModule, mkModuleName )
import OccName	  ( dataName, tcName, clsName, varName, mkOccFS
54
		  )
55
56
		  
import RdrName	  ( RdrName, nameRdrName, mkOrig, rdrNameOcc )
57
58
import Unique	  ( Unique, Uniquable(..), hasKey,
		    mkPreludeMiscIdUnique, mkPreludeDataConUnique,
59
		    mkPreludeTyConUnique, mkPreludeClassUnique,
60
		    mkTupleTyConUnique, isTupleKey
61
		  ) 
62
63
import BasicTypes ( Boxity(..), Arity )
import Name	  ( Name, mkInternalName, mkExternalName, nameUnique, nameModule )
64
import SrcLoc     ( noSrcLoc )
65
import FastString
66
67


68
69
\end{code}

70

71
72
73
74
75
76
77
78
79
%************************************************************************
%*									*
\subsection{Local Names}
%*									*
%************************************************************************

This *local* name is used by the interactive stuff

\begin{code}
80
itName uniq = mkInternalName uniq (mkOccFS varName FSLIT("it")) noSrcLoc
81
82
83
84
85
86
\end{code}

\begin{code}
-- mkUnboundName makes a place-holder Name; it shouldn't be looked at except possibly
-- during compiler debugging.
mkUnboundName :: RdrName -> Name
87
mkUnboundName rdr_name = mkInternalName unboundKey (rdrNameOcc rdr_name) noSrcLoc
88
89
90
91
92
93

isUnboundName :: Name -> Bool
isUnboundName name = name `hasKey` unboundKey
\end{code}


94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
%************************************************************************
%*									*
\subsection{Built-in-syntax names
%*									*
%************************************************************************

Built-in syntax names are parsed directly into Exact RdrNames.
This predicate just identifies them. 

\begin{code}
isBuiltInSyntaxName :: Name -> Bool
isBuiltInSyntaxName n
  =  isTupleKey uniq
  || uniq `elem` [listTyConKey, nilDataConKey, consDataConKey,
		  funTyConKey, parrTyConKey]
  where
     uniq = nameUnique n
\end{code}

113
114
%************************************************************************
%*									*
115
\subsection{Known key Names}
116
117
118
%*									*
%************************************************************************

119
120
121
This section tells what the compiler knows about the assocation of
names with uniques.  These ones are the *non* wired-in ones.  The
wired in ones are defined in TysWiredIn etc.
122
123

\begin{code}
124
125
basicKnownKeyNames :: [Name]
basicKnownKeyNames
126
127
128
 = genericTyConNames
 ++ monadNames
 ++ [	-- Type constructors (synonyms especially)
129
	ioTyConName, ioDataConName,
130
	runIOName,
131
132
133
134
135
136
	orderingTyConName,
	rationalTyConName,
	ratioDataConName,
	ratioTyConName,
	byteArrayTyConName,
	mutableByteArrayTyConName,
137
	integerTyConName, smallIntegerDataConName, largeIntegerDataConName,
138
139
140
141

	--  Classes.  *Must* include:
	--  	classes that are grabbed by key (e.g., eqClassKey)
	--  	classes in "Class.standardClassKeys" (quite a few)
142
143
144
145
146
147
148
149
150
151
152
153
154
	eqClassName,			-- mentioned, derivable
	ordClassName,			-- derivable
	boundedClassName,		-- derivable
	numClassName,			-- mentioned, numeric
	enumClassName,			-- derivable
	monadClassName,
    	functorClassName,
	realClassName,			-- numeric
	integralClassName,		-- numeric
	fractionalClassName,		-- numeric
	floatingClassName,		-- numeric
	realFracClassName,		-- numeric
	realFloatClassName,		-- numeric
155
	dataClassName, 
156
	typeableClassName,
157

158
159
160
161
162
163
164
165
166
167
168
169
170
	-- Numeric stuff
	negateName, minusName, 
	fromRationalName, fromIntegerName, 
	geName, eqName, 
	
	-- Enum stuff
	enumFromName, enumFromThenName,	
	enumFromThenToName, enumFromToName,
	enumFromToPName, enumFromThenToPName,

	-- Monad stuff
	thenIOName, bindIOName, returnIOName, failIOName,

171
172
173
	-- MonadRec stuff
	mfixName,

174
175
176
177
	-- Arrow stuff
	arrAName, composeAName, firstAName,
	appAName, choiceAName, loopAName,

178
179
180
181
182
183
184
185
186
187
	-- Ix stuff
	ixClassName, 

	-- Show stuff
	showClassName, 

	-- Read stuff
	readClassName, 
	
	-- Stable pointers
188
	newStablePtrName,
189
190

	-- Strings and lists
191
192
	unpackCStringName, unpackCStringAppendName,
	unpackCStringFoldrName, unpackCStringUtf8Name,
193
194

	-- List operations
195
196
	concatName, filterName,
	zipName, foldrName, buildName, augmentName, appendName,
197

chak's avatar
chak committed
198
        -- Parallel array operations
199
200
201
202
	nullPName, lengthPName, replicatePName,	mapPName,
	filterPName, zipPName, crossPName, indexPName,
	toPName, bpermutePName, bpermuteDftPName, indexOfPName,

203
	-- FFI primitive types that are not wired-in.
204
	stablePtrTyConName, ptrTyConName, funPtrTyConName, addrTyConName,
205
	int8TyConName, int16TyConName, int32TyConName, int64TyConName,
206
	wordTyConName, word8TyConName, word16TyConName, word32TyConName, word64TyConName,
207
208

	-- Others
209
	otherwiseIdName, 
210
	plusIntegerName, timesIntegerName,
211
	eqStringName, assertName, assertErrorName, runSTRepName,
212
213
214
215
	printName, splitName, fstName, sndName,

	-- Booleans
	andName, orName
sof's avatar
sof committed
216
	
217
218
219
	-- The Either type
	, eitherTyConName, leftDataConName, rightDataConName

sof's avatar
sof committed
220
221
222
	-- dotnet interop
	, objectTyConName, marshalObjectName, unmarshalObjectName
	, marshalStringName, unmarshalStringName, checkDotnetResName
223
    ]
224
225
226

monadNames :: [Name]	-- The monad ops need by a HsDo
monadNames = [returnMName, failMName, bindMName, thenMName]
227
228
229

genericTyConNames :: [Name]
genericTyConNames = [crossTyConName, plusTyConName, genUnitTyConName]
230
231
232
\end{code}


233
234
235
236
237
238
%************************************************************************
%*									*
\subsection{Module names}
%*									*
%************************************************************************

239
240

--MetaHaskell Extension Add a new module here
241
\begin{code}
242
pRELUDE_Name      = mkModuleName "Prelude"
243
gHC_PRIM_Name     = mkModuleName "GHC.Prim"	   -- Primitive types and values
244
245
246
247
248
249
250
251
pREL_BASE_Name    = mkModuleName "GHC.Base"
pREL_ENUM_Name    = mkModuleName "GHC.Enum"
pREL_SHOW_Name    = mkModuleName "GHC.Show"
pREL_READ_Name    = mkModuleName "GHC.Read"
pREL_NUM_Name     = mkModuleName "GHC.Num"
pREL_LIST_Name    = mkModuleName "GHC.List"
pREL_PARR_Name    = mkModuleName "GHC.PArr"
pREL_TUP_Name     = mkModuleName "Data.Tuple"
252
pREL_EITHER_Name  = mkModuleName "Data.Either"
253
254
255
256
257
pREL_PACK_Name    = mkModuleName "GHC.Pack"
pREL_CONC_Name    = mkModuleName "GHC.Conc"
pREL_IO_BASE_Name = mkModuleName "GHC.IOBase"
pREL_ST_Name	  = mkModuleName "GHC.ST"
pREL_ARR_Name     = mkModuleName "GHC.Arr"
258
pREL_BYTEARR_Name = mkModuleName "PrelByteArr"
259
260
261
262
263
264
265
pREL_STABLE_Name  = mkModuleName "GHC.Stable"
pREL_ADDR_Name    = mkModuleName "GHC.Addr"
pREL_PTR_Name     = mkModuleName "GHC.Ptr"
pREL_ERR_Name     = mkModuleName "GHC.Err"
pREL_REAL_Name    = mkModuleName "GHC.Real"
pREL_FLOAT_Name   = mkModuleName "GHC.Float"
pREL_TOP_HANDLER_Name = mkModuleName "GHC.TopHandler"
266
sYSTEM_IO_Name	  = mkModuleName "System.IO"
267
dYNAMIC_Name	  = mkModuleName "Data.Dynamic"
ralf's avatar
ralf committed
268
tYPEABLE_Name	  = mkModuleName "Data.Typeable"
269
gENERICS_Name	  = mkModuleName "Data.Generics.Basics"
sof's avatar
sof committed
270
dOTNET_Name       = mkModuleName "GHC.Dotnet"
271

272
273
274
rEAD_PREC_Name = mkModuleName "Text.ParserCombinators.ReadPrec"
lEX_Name       = mkModuleName "Text.Read.Lex"

275
mAIN_Name	  = mkModuleName "Main"
276
277
pREL_INT_Name	  = mkModuleName "GHC.Int"
pREL_WORD_Name	  = mkModuleName "GHC.Word"
278
mONAD_FIX_Name	  = mkModuleName "Control.Monad.Fix"
279
aRROW_Name	  = mkModuleName "Control.Arrow"
280
281
aDDR_Name	  = mkModuleName "Addr"

282
gLA_EXTS_Name   = mkModuleName "GHC.Exts"
283

284
285
gHC_PRIM     	= mkBasePkgModule gHC_PRIM_Name
pREL_BASE    	= mkBasePkgModule pREL_BASE_Name
286
287
288
289
290
pREL_TUP    	= mkBasePkgModule pREL_TUP_Name
pREL_EITHER	= mkBasePkgModule pREL_EITHER_Name
pREL_LIST	= mkBasePkgModule pREL_LIST_Name
pREL_SHOW	= mkBasePkgModule pREL_SHOW_Name
pREL_READ	= mkBasePkgModule pREL_READ_Name
291
pREL_ADDR    	= mkBasePkgModule pREL_ADDR_Name
292
293
pREL_WORD    	= mkBasePkgModule pREL_WORD_Name
pREL_INT    	= mkBasePkgModule pREL_INT_Name
294
pREL_PTR    	= mkBasePkgModule pREL_PTR_Name
295
pREL_ST    	= mkBasePkgModule pREL_ST_Name
296
297
298
299
300
pREL_STABLE  	= mkBasePkgModule pREL_STABLE_Name
pREL_IO_BASE 	= mkBasePkgModule pREL_IO_BASE_Name
pREL_PACK    	= mkBasePkgModule pREL_PACK_Name
pREL_ERR     	= mkBasePkgModule pREL_ERR_Name
pREL_NUM     	= mkBasePkgModule pREL_NUM_Name
301
pREL_ENUM     	= mkBasePkgModule pREL_ENUM_Name
302
303
pREL_REAL    	= mkBasePkgModule pREL_REAL_Name
pREL_FLOAT   	= mkBasePkgModule pREL_FLOAT_Name
304
305
306
307
pREL_ARR   	= mkBasePkgModule pREL_ARR_Name
pREL_PARR   	= mkBasePkgModule pREL_PARR_Name
pREL_BYTEARR   	= mkBasePkgModule pREL_BYTEARR_Name
pREL_TOP_HANDLER= mkBasePkgModule pREL_TOP_HANDLER_Name
308
pRELUDE		= mkBasePkgModule pRELUDE_Name
309
310
311
312
313
314
315
316
sYSTEM_IO	= mkBasePkgModule sYSTEM_IO_Name
aDDR		= mkBasePkgModule aDDR_Name
aRROW		= mkBasePkgModule aRROW_Name
gENERICS	= mkBasePkgModule gENERICS_Name
tYPEABLE	= mkBasePkgModule tYPEABLE_Name
dOTNET		= mkBasePkgModule dOTNET_Name
gLA_EXTS	= mkBasePkgModule gLA_EXTS_Name
mONAD_FIX	= mkBasePkgModule mONAD_FIX_Name
317

318
319
320
321
322
323
324
rOOT_MAIN_Name = mkModuleName ":Main"		-- Root module for initialisation 
rOOT_MAIN      = mkHomeModule rOOT_MAIN_Name	
	-- The ':xxx' makes a moudle name that the user can never
	-- use himself.  The z-encoding for ':' is "ZC", so the z-encoded
	-- module name still starts with a capital letter, which keeps
	-- the z-encoded version consistent.
iNTERACTIVE    = mkHomeModule (mkModuleName ":Interactive")
325
326
327
328
329
330
331
332
333
\end{code}

%************************************************************************
%*									*
\subsection{Constructing the names of tuples
%*									*
%************************************************************************

\begin{code}
334
335
336
337
mkTupleModule :: Boxity -> Arity -> Module
mkTupleModule Boxed   0 = pREL_BASE
mkTupleModule Boxed   _ = pREL_TUP
mkTupleModule Unboxed _ = gHC_PRIM
338
339
340
\end{code}


341
342
%************************************************************************
%*									*
343
			RdrNames
344
345
346
347
%*									*
%************************************************************************

\begin{code}
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
eq_RDR 			= nameRdrName eqName
ge_RDR 			= nameRdrName geName
ne_RDR 			= varQual_RDR  pREL_BASE_Name FSLIT("/=")
le_RDR 			= varQual_RDR  pREL_BASE_Name FSLIT("<=") 
gt_RDR 			= varQual_RDR  pREL_BASE_Name FSLIT(">")  
compare_RDR		= varQual_RDR  pREL_BASE_Name FSLIT("compare") 
ltTag_RDR		= dataQual_RDR pREL_BASE_Name FSLIT("LT") 
eqTag_RDR		= dataQual_RDR pREL_BASE_Name FSLIT("EQ")
gtTag_RDR		= dataQual_RDR pREL_BASE_Name FSLIT("GT")

eqClass_RDR		= nameRdrName eqClassName
numClass_RDR 		= nameRdrName numClassName
ordClass_RDR 		= nameRdrName ordClassName
enumClass_RDR		= nameRdrName enumClassName
monadClass_RDR		= nameRdrName monadClassName

map_RDR 		= varQual_RDR pREL_BASE_Name FSLIT("map")
append_RDR 		= varQual_RDR pREL_BASE_Name FSLIT("++")

foldr_RDR 		= nameRdrName foldrName
build_RDR 		= nameRdrName buildName
returnM_RDR 		= nameRdrName returnMName
bindM_RDR 		= nameRdrName bindMName
failM_RDR 		= nameRdrName failMName

and_RDR			= nameRdrName andName

375
376
377
left_RDR		= nameRdrName leftDataConName
right_RDR		= nameRdrName rightDataConName

378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
fromEnum_RDR		= varQual_RDR pREL_ENUM_Name FSLIT("fromEnum")
toEnum_RDR		= varQual_RDR pREL_ENUM_Name FSLIT("toEnum")

enumFrom_RDR		= nameRdrName enumFromName
enumFromTo_RDR 		= nameRdrName enumFromToName
enumFromThen_RDR	= nameRdrName enumFromThenName
enumFromThenTo_RDR	= nameRdrName enumFromThenToName

ratioDataCon_RDR	= nameRdrName ratioDataConName
plusInteger_RDR		= nameRdrName plusIntegerName
timesInteger_RDR	= nameRdrName timesIntegerName

ioDataCon_RDR		= nameRdrName ioDataConName

eqString_RDR		= nameRdrName eqStringName
unpackCString_RDR      	= nameRdrName unpackCStringName
unpackCStringFoldr_RDR 	= nameRdrName unpackCStringFoldrName
unpackCStringUtf8_RDR  	= nameRdrName unpackCStringUtf8Name

newStablePtr_RDR 	= nameRdrName newStablePtrName
398
addrDataCon_RDR		= dataQual_RDR aDDR_Name FSLIT("A#")
399
wordDataCon_RDR		= dataQual_RDR pREL_WORD_Name FSLIT("W#")
400
401
402
403
404
405
406
407
408
409
410
411
412

bindIO_RDR	  	= nameRdrName bindIOName
returnIO_RDR	  	= nameRdrName returnIOName

fromInteger_RDR		= nameRdrName fromIntegerName
fromRational_RDR	= nameRdrName fromRationalName
minus_RDR		= nameRdrName minusName
times_RDR		= varQual_RDR  pREL_NUM_Name FSLIT("*")
plus_RDR                = varQual_RDR pREL_NUM_Name FSLIT("+")

compose_RDR		= varQual_RDR pREL_BASE_Name FSLIT(".")

not_RDR 		= varQual_RDR pREL_BASE_Name FSLIT("not")
413
getTag_RDR	 	= varQual_RDR pREL_BASE_Name FSLIT("getTag")
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
succ_RDR 		= varQual_RDR pREL_ENUM_Name FSLIT("succ")
pred_RDR                = varQual_RDR pREL_ENUM_Name FSLIT("pred")
minBound_RDR            = varQual_RDR pREL_ENUM_Name FSLIT("minBound")
maxBound_RDR            = varQual_RDR pREL_ENUM_Name FSLIT("maxBound")
range_RDR               = varQual_RDR pREL_ARR_Name FSLIT("range")
inRange_RDR             = varQual_RDR pREL_ARR_Name FSLIT("inRange")
index_RDR		= varQual_RDR pREL_ARR_Name FSLIT("index")

readList_RDR            = varQual_RDR pREL_READ_Name FSLIT("readList")
readListDefault_RDR     = varQual_RDR pREL_READ_Name FSLIT("readListDefault")
readListPrec_RDR        = varQual_RDR pREL_READ_Name FSLIT("readListPrec")
readListPrecDefault_RDR = varQual_RDR pREL_READ_Name FSLIT("readListPrecDefault")
readPrec_RDR            = varQual_RDR pREL_READ_Name FSLIT("readPrec")
parens_RDR              = varQual_RDR pREL_READ_Name FSLIT("parens")
choose_RDR              = varQual_RDR pREL_READ_Name FSLIT("choose")
lexP_RDR                = varQual_RDR pREL_READ_Name FSLIT("lexP")

punc_RDR                = dataQual_RDR lEX_Name FSLIT("Punc")
ident_RDR               = dataQual_RDR lEX_Name FSLIT("Ident")
symbol_RDR              = dataQual_RDR lEX_Name FSLIT("Symbol")

step_RDR                = varQual_RDR  rEAD_PREC_Name FSLIT("step")
alt_RDR                 = varQual_RDR  rEAD_PREC_Name FSLIT("+++") 
reset_RDR               = varQual_RDR  rEAD_PREC_Name FSLIT("reset")
prec_RDR                = varQual_RDR  rEAD_PREC_Name FSLIT("prec")

showList_RDR            = varQual_RDR pREL_SHOW_Name FSLIT("showList")
showList___RDR          = varQual_RDR pREL_SHOW_Name FSLIT("showList__")
showsPrec_RDR           = varQual_RDR pREL_SHOW_Name FSLIT("showsPrec") 
showString_RDR          = varQual_RDR pREL_SHOW_Name FSLIT("showString")
showSpace_RDR           = varQual_RDR pREL_SHOW_Name FSLIT("showSpace") 
showParen_RDR           = varQual_RDR pREL_SHOW_Name FSLIT("showParen") 
446

ralf's avatar
ralf committed
447
448
449
typeOf_RDR     = varQual_RDR tYPEABLE_Name FSLIT("typeOf")
mkTypeRep_RDR  = varQual_RDR tYPEABLE_Name FSLIT("mkAppTy")
mkTyConRep_RDR = varQual_RDR tYPEABLE_Name FSLIT("mkTyCon")
450

451
undefined_RDR = varQual_RDR pREL_ERR_Name FSLIT("undefined")
452

453
454
455
456
457
458
459
460
461
462
463
crossDataCon_RDR   = dataQual_RDR pREL_BASE_Name FSLIT(":*:")
inlDataCon_RDR     = dataQual_RDR pREL_BASE_Name FSLIT("Inl")
inrDataCon_RDR     = dataQual_RDR pREL_BASE_Name FSLIT("Inr")
genUnitDataCon_RDR = dataQual_RDR pREL_BASE_Name FSLIT("Unit")

----------------------
varQual_RDR  mod str = mkOrig mod (mkOccFS varName str)
tcQual_RDR   mod str = mkOrig mod (mkOccFS tcName str)
clsQual_RDR  mod str = mkOrig mod (mkOccFS clsName str)
dataQual_RDR mod str = mkOrig mod (mkOccFS dataName str)
\end{code}
464

465
466
%************************************************************************
%*									*
467
\subsection{Known-key names}
468
469
470
%*									*
%************************************************************************

471
Many of these Names are not really "built in", but some parts of the
472
473
compiler (notably the deriving mechanism) need to mention their names,
and it's convenient to write them all down in one place.
474

475
476
477
478
--MetaHaskell Extension  add the constrs and the lower case case
-- guys as well (perhaps) e.g. see  trueDataConName	below


479
\begin{code}
480
481
482
483
484
485
486
487
rootMainName = varQual rOOT_MAIN FSLIT("main") rootMainKey
runIOName    = varQual pREL_TOP_HANDLER FSLIT("runIO") runMainKey

orderingTyConName = tcQual   pREL_BASE FSLIT("Ordering") orderingTyConKey

eitherTyConName	  = tcQual  pREL_EITHER     FSLIT("Either") eitherTyConKey
leftDataConName   = conName eitherTyConName FSLIT("Left")   leftDataConKey
rightDataConName  = conName eitherTyConName FSLIT("Right")  rightDataConKey
488

489
-- Generics
490
491
492
crossTyConName     = tcQual   pREL_BASE FSLIT(":*:") crossTyConKey
plusTyConName      = tcQual   pREL_BASE FSLIT(":+:") plusTyConKey
genUnitTyConName   = tcQual   pREL_BASE FSLIT("Unit") genUnitTyConKey
493

494
-- Base strings Strings
495
496
497
498
499
unpackCStringName       = varQual pREL_BASE FSLIT("unpackCString#") unpackCStringIdKey
unpackCStringAppendName = varQual pREL_BASE FSLIT("unpackAppendCString#") unpackCStringAppendIdKey
unpackCStringFoldrName  = varQual pREL_BASE FSLIT("unpackFoldrCString#") unpackCStringFoldrIdKey
unpackCStringUtf8Name   = varQual pREL_BASE FSLIT("unpackCStringUtf8#") unpackCStringUtf8IdKey
eqStringName	 	= varQual pREL_BASE FSLIT("eqString")  eqStringIdKey
500

501
-- Base classes (Eq, Ord, Functor)
502
503
504
505
506
eqClassName	  = clsQual pREL_BASE FSLIT("Eq") eqClassKey
eqName		  = methName eqClassName FSLIT("==") eqClassOpKey
ordClassName	  = clsQual pREL_BASE FSLIT("Ord") ordClassKey
geName		  = methName ordClassName FSLIT(">=") geClassOpKey
functorClassName  = clsQual pREL_BASE FSLIT("Functor") functorClassKey
507
508

-- Class Monad
509
510
511
512
513
monadClassName	   = clsQual pREL_BASE FSLIT("Monad") monadClassKey
thenMName	   = methName monadClassName FSLIT(">>")  thenMClassOpKey
bindMName	   = methName monadClassName FSLIT(">>=") bindMClassOpKey
returnMName	   = methName monadClassName FSLIT("return") returnMClassOpKey
failMName	   = methName monadClassName FSLIT("fail") failMClassOpKey
514

515
-- Random PrelBase functions
516
517
518
519
520
521
522
523
otherwiseIdName   = varQual pREL_BASE FSLIT("otherwise") otherwiseIdKey
foldrName	  = varQual pREL_BASE FSLIT("foldr")     foldrIdKey
buildName	  = varQual pREL_BASE FSLIT("build")     buildIdKey
augmentName	  = varQual pREL_BASE FSLIT("augment")   augmentIdKey
appendName	  = varQual pREL_BASE FSLIT("++")        appendIdKey
andName		  = varQual pREL_BASE FSLIT("&&")	      andIdKey
orName		  = varQual pREL_BASE FSLIT("||")	      orIdKey
assertName        = varQual pREL_BASE FSLIT("assert")    assertIdKey
524

525
-- PrelTup
526
527
fstName		  = varQual pREL_TUP FSLIT("fst") fstIdKey
sndName		  = varQual pREL_TUP FSLIT("snd") sndIdKey
528

529
-- Module PrelNum
530
531
532
533
534
535
536
537
538
numClassName	  = clsQual pREL_NUM FSLIT("Num") numClassKey
fromIntegerName   = methName numClassName FSLIT("fromInteger") fromIntegerClassOpKey
minusName	  = methName numClassName FSLIT("-") minusClassOpKey
negateName	  = methName numClassName FSLIT("negate") negateClassOpKey
plusIntegerName   = varQual pREL_NUM FSLIT("plusInteger") plusIntegerIdKey
timesIntegerName  = varQual pREL_NUM FSLIT("timesInteger") timesIntegerIdKey
integerTyConName  = tcQual  pREL_NUM FSLIT("Integer") integerTyConKey
smallIntegerDataConName = conName integerTyConName FSLIT("S#") smallIntegerDataConKey
largeIntegerDataConName = conName integerTyConName FSLIT("J#") largeIntegerDataConKey
539

540
-- PrelReal types and classes
541
542
543
544
545
546
547
548
rationalTyConName   = tcQual  pREL_REAL  FSLIT("Rational") rationalTyConKey
ratioTyConName	    = tcQual  pREL_REAL  FSLIT("Ratio") ratioTyConKey
ratioDataConName    = conName ratioTyConName FSLIT(":%") ratioDataConKey
realClassName	    = clsQual pREL_REAL  FSLIT("Real") realClassKey
integralClassName   = clsQual pREL_REAL  FSLIT("Integral") integralClassKey
realFracClassName   = clsQual pREL_REAL  FSLIT("RealFrac") realFracClassKey
fractionalClassName = clsQual pREL_REAL  FSLIT("Fractional") fractionalClassKey
fromRationalName    = methName fractionalClassName  FSLIT("fromRational") fromRationalClassOpKey
549
550

-- PrelFloat classes
551
552
floatingClassName  = clsQual  pREL_FLOAT FSLIT("Floating") floatingClassKey
realFloatClassName = clsQual  pREL_FLOAT FSLIT("RealFloat") realFloatClassKey
553
554

-- Class Ix
555
ixClassName	   = clsQual pREL_ARR FSLIT("Ix") ixClassKey
556

557
-- Class Typeable and Data
558
559
560
561
562
typeableClassName = clsQual tYPEABLE FSLIT("Typeable") typeableClassKey
dataClassName     = clsQual gENERICS FSLIT("Data")     dataClassKey

-- Error module
assertErrorName	  = varQual pREL_ERR FSLIT("assertError") assertErrorIdKey
563

564
-- Enum module (Enum, Bounded)
565
566
567
568
569
570
enumClassName 	   = clsQual pREL_ENUM FSLIT("Enum") enumClassKey
enumFromName	   = methName enumClassName FSLIT("enumFrom") enumFromClassOpKey
enumFromToName	   = methName enumClassName FSLIT("enumFromTo") enumFromToClassOpKey
enumFromThenName   = methName enumClassName FSLIT("enumFromThen") enumFromThenClassOpKey
enumFromThenToName = methName enumClassName FSLIT("enumFromThenTo") enumFromThenToClassOpKey
boundedClassName   = clsQual pREL_ENUM FSLIT("Bounded") boundedClassKey
571
572

-- List functions
573
574
575
concatName	  = varQual pREL_LIST FSLIT("concat") concatIdKey
filterName	  = varQual pREL_LIST FSLIT("filter") filterIdKey
zipName	   	  = varQual pREL_LIST FSLIT("zip") zipIdKey
576

577
-- Class Show
578
showClassName	  = clsQual pREL_SHOW FSLIT("Show")       showClassKey
579
580

-- Class Read
581
readClassName	   = clsQual pREL_READ FSLIT("Read") readClassKey
582

chak's avatar
chak committed
583
-- parallel array types and functions
584
585
586
587
588
589
590
591
592
593
594
595
596
597
enumFromToPName	   = varQual pREL_PARR FSLIT("enumFromToP") enumFromToPIdKey
enumFromThenToPName= varQual pREL_PARR FSLIT("enumFromThenToP") enumFromThenToPIdKey
nullPName	  = varQual pREL_PARR FSLIT("nullP")      	 nullPIdKey
lengthPName	  = varQual pREL_PARR FSLIT("lengthP")    	 lengthPIdKey
replicatePName	  = varQual pREL_PARR FSLIT("replicateP") 	 replicatePIdKey
mapPName	  = varQual pREL_PARR FSLIT("mapP")       	 mapPIdKey
filterPName	  = varQual pREL_PARR FSLIT("filterP")    	 filterPIdKey
zipPName	  = varQual pREL_PARR FSLIT("zipP")       	 zipPIdKey
crossPName	  = varQual pREL_PARR FSLIT("crossP")     	 crossPIdKey
indexPName	  = varQual pREL_PARR FSLIT("!:")	       	 indexPIdKey
toPName	          = varQual pREL_PARR FSLIT("toP")	       	 toPIdKey
bpermutePName     = varQual pREL_PARR FSLIT("bpermuteP")    bpermutePIdKey
bpermuteDftPName  = varQual pREL_PARR FSLIT("bpermuteDftP") bpermuteDftPIdKey
indexOfPName      = varQual pREL_PARR FSLIT("indexOfP")     indexOfPIdKey
chak's avatar
chak committed
598

599
-- IOBase things
600
601
602
603
604
605
ioTyConName	  = tcQual  pREL_IO_BASE FSLIT("IO") ioTyConKey
ioDataConName     = conName ioTyConName  FSLIT("IO") ioDataConKey
thenIOName	  = varQual pREL_IO_BASE FSLIT("thenIO") thenIOIdKey
bindIOName	  = varQual pREL_IO_BASE FSLIT("bindIO") bindIOIdKey
returnIOName	  = varQual pREL_IO_BASE FSLIT("returnIO") returnIOIdKey
failIOName	  = varQual pREL_IO_BASE FSLIT("failIO") failIOIdKey
606

607
-- IO things
608
printName	  = varQual sYSTEM_IO FSLIT("print") printIdKey
609

610
-- Int, Word, and Addr things
611
612
613
614
int8TyConName     = tcQual pREL_INT  FSLIT("Int8") int8TyConKey
int16TyConName    = tcQual pREL_INT  FSLIT("Int16") int16TyConKey
int32TyConName    = tcQual pREL_INT  FSLIT("Int32") int32TyConKey
int64TyConName    = tcQual pREL_INT  FSLIT("Int64") int64TyConKey
615

616
-- Word module
617
618
619
620
621
622
word8TyConName    = tcQual  pREL_WORD FSLIT("Word8")  word8TyConKey
word16TyConName   = tcQual  pREL_WORD FSLIT("Word16") word16TyConKey
word32TyConName   = tcQual  pREL_WORD FSLIT("Word32") word32TyConKey
word64TyConName   = tcQual  pREL_WORD FSLIT("Word64") word64TyConKey
wordTyConName     = tcQual  pREL_WORD FSLIT("Word")   wordTyConKey
wordDataConName   = conName wordTyConName FSLIT("W#") wordDataConKey
623

624
-- Addr module
625
addrTyConName	  = tcQual   aDDR FSLIT("Addr") addrTyConKey
626

627
-- PrelPtr module
628
629
ptrTyConName	  = tcQual   pREL_PTR FSLIT("Ptr") ptrTyConKey
funPtrTyConName	  = tcQual   pREL_PTR FSLIT("FunPtr") funPtrTyConKey
630

631
-- Byte array types
632
633
byteArrayTyConName	  = tcQual pREL_BYTEARR  FSLIT("ByteArray") byteArrayTyConKey
mutableByteArrayTyConName = tcQual pREL_BYTEARR  FSLIT("MutableByteArray") mutableByteArrayTyConKey
634

chak's avatar
chak committed
635
-- Foreign objects and weak pointers
636
637
stablePtrTyConName    = tcQual   pREL_STABLE FSLIT("StablePtr") stablePtrTyConKey
newStablePtrName      = varQual  pREL_STABLE FSLIT("newStablePtr") newStablePtrIdKey
638
639

-- PrelST module
640
runSTRepName	   = varQual pREL_ST  FSLIT("runSTRep") runSTRepIdKey
641
642

-- The "split" Id for splittable implicit parameters
643
splitName          = varQual gLA_EXTS FSLIT("split") splitIdKey
644
645

-- Recursive-do notation
646
mfixName	   = varQual mONAD_FIX FSLIT("mfix") mfixIdKey
sof's avatar
sof committed
647

648
-- Arrow notation
649
650
651
652
653
654
arrAName	   = varQual aRROW FSLIT("arr")	arrAIdKey
composeAName	   = varQual aRROW FSLIT(">>>")	composeAIdKey
firstAName	   = varQual aRROW FSLIT("first")	firstAIdKey
appAName	   = varQual aRROW FSLIT("app")	appAIdKey
choiceAName	   = varQual aRROW FSLIT("|||")	choiceAIdKey
loopAName	   = varQual aRROW FSLIT("loop")	loopAIdKey
655

sof's avatar
sof committed
656
-- dotnet interop
657
658
659
660
661
662
663
664
objectTyConName	    = tcQual   dOTNET FSLIT("Object") objectTyConKey
	-- objectTyConName was "wTcQual", but that's gone now, and
	-- I can't see why it was wired in anyway...
unmarshalObjectName = varQual  dOTNET FSLIT("unmarshalObject") unmarshalObjectIdKey
marshalObjectName   = varQual  dOTNET FSLIT("marshalObject") marshalObjectIdKey
marshalStringName   = varQual  dOTNET FSLIT("marshalString") marshalStringIdKey
unmarshalStringName = varQual  dOTNET FSLIT("unmarshalString") unmarshalStringIdKey
checkDotnetResName  = varQual  dOTNET FSLIT("checkResult")     checkDotnetResNameIdKey
665
666
667
668
669
670
671
672
\end{code}

%************************************************************************
%*									*
\subsection{Local helpers}
%*									*
%************************************************************************

673
All these are original names; hence mkOrig
674

675
\begin{code}
676
varQual  = mk_known_key_name varName
677
678
679
680
tcQual   = mk_known_key_name tcName
clsQual  = mk_known_key_name clsName

mk_known_key_name space mod str uniq 
681
682
683
684
685
686
687
688
689
690
691
692
  = mkExternalName uniq mod (mkOccFS space str) 
		   Nothing noSrcLoc

conName :: Name -> FastString -> Unique -> Name
conName tycon occ uniq
  = mkExternalName uniq (nameModule tycon) (mkOccFS dataName occ) 
		   (Just tycon) noSrcLoc

methName :: Name -> FastString -> Unique -> Name
methName cls occ uniq
  = mkExternalName uniq (nameModule cls) (mkOccFS varName occ) 
		   (Just cls) noSrcLoc
693
\end{code}
694
695
696
697
698
699

%************************************************************************
%*									*
\subsubsection[Uniques-prelude-Classes]{@Uniques@ for wired-in @Classes@}
%*									*
%************************************************************************
700
--MetaHaskell extension hand allocate keys here
701
702
703
704
705

\begin{code}
boundedClassKey		= mkPreludeClassUnique 1 
enumClassKey		= mkPreludeClassUnique 2 
eqClassKey		= mkPreludeClassUnique 3 
706
typeableClassKey	= mkPreludeClassUnique 4
707
708
709
710
floatingClassKey	= mkPreludeClassUnique 5 
fractionalClassKey	= mkPreludeClassUnique 6 
integralClassKey	= mkPreludeClassUnique 7 
monadClassKey		= mkPreludeClassUnique 8 
711
dataClassKey		= mkPreludeClassUnique 9
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
functorClassKey		= mkPreludeClassUnique 10
numClassKey		= mkPreludeClassUnique 11
ordClassKey		= mkPreludeClassUnique 12
readClassKey		= mkPreludeClassUnique 13
realClassKey		= mkPreludeClassUnique 14
realFloatClassKey	= mkPreludeClassUnique 15
realFracClassKey	= mkPreludeClassUnique 16
showClassKey		= mkPreludeClassUnique 17
ixClassKey		= mkPreludeClassUnique 20
\end{code}

%************************************************************************
%*									*
\subsubsection[Uniques-prelude-TyCons]{@Uniques@ for wired-in @TyCons@}
%*									*
%************************************************************************

\begin{code}
addrPrimTyConKey			= mkPreludeTyConUnique	1
addrTyConKey				= mkPreludeTyConUnique	2
arrayPrimTyConKey			= mkPreludeTyConUnique	3
boolTyConKey				= mkPreludeTyConUnique	4
byteArrayPrimTyConKey			= mkPreludeTyConUnique	5
charPrimTyConKey			= mkPreludeTyConUnique	7
charTyConKey				= mkPreludeTyConUnique  8
doublePrimTyConKey			= mkPreludeTyConUnique  9
doubleTyConKey				= mkPreludeTyConUnique 10 
floatPrimTyConKey			= mkPreludeTyConUnique 11
floatTyConKey				= mkPreludeTyConUnique 12
funTyConKey				= mkPreludeTyConUnique 13
intPrimTyConKey				= mkPreludeTyConUnique 14
intTyConKey				= mkPreludeTyConUnique 15
int8TyConKey				= mkPreludeTyConUnique 16
int16TyConKey				= mkPreludeTyConUnique 17
apt's avatar
apt committed
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
int32PrimTyConKey			= mkPreludeTyConUnique 18
int32TyConKey				= mkPreludeTyConUnique 19
int64PrimTyConKey			= mkPreludeTyConUnique 20
int64TyConKey				= mkPreludeTyConUnique 21
integerTyConKey				= mkPreludeTyConUnique 22
listTyConKey				= mkPreludeTyConUnique 23
foreignObjPrimTyConKey			= mkPreludeTyConUnique 24
weakPrimTyConKey			= mkPreludeTyConUnique 27
mutableArrayPrimTyConKey		= mkPreludeTyConUnique 28
mutableByteArrayPrimTyConKey		= mkPreludeTyConUnique 29
orderingTyConKey			= mkPreludeTyConUnique 30
mVarPrimTyConKey		    	= mkPreludeTyConUnique 31
ratioTyConKey				= mkPreludeTyConUnique 32
rationalTyConKey			= mkPreludeTyConUnique 33
realWorldTyConKey			= mkPreludeTyConUnique 34
stablePtrPrimTyConKey			= mkPreludeTyConUnique 35
stablePtrTyConKey			= mkPreludeTyConUnique 36
statePrimTyConKey			= mkPreludeTyConUnique 50
stableNamePrimTyConKey			= mkPreludeTyConUnique 51
stableNameTyConKey		        = mkPreludeTyConUnique 52
mutableByteArrayTyConKey		= mkPreludeTyConUnique 53
mutVarPrimTyConKey			= mkPreludeTyConUnique 55
ioTyConKey				= mkPreludeTyConUnique 56
byteArrayTyConKey			= mkPreludeTyConUnique 57
wordPrimTyConKey			= mkPreludeTyConUnique 58
wordTyConKey				= mkPreludeTyConUnique 59
word8TyConKey				= mkPreludeTyConUnique 60
word16TyConKey				= mkPreludeTyConUnique 61 
word32PrimTyConKey			= mkPreludeTyConUnique 62 
word32TyConKey				= mkPreludeTyConUnique 63
word64PrimTyConKey			= mkPreludeTyConUnique 64
word64TyConKey				= mkPreludeTyConUnique 65
liftedConKey				= mkPreludeTyConUnique 66
unliftedConKey				= mkPreludeTyConUnique 67
anyBoxConKey				= mkPreludeTyConUnique 68
kindConKey				= mkPreludeTyConUnique 69
boxityConKey				= mkPreludeTyConUnique 70
typeConKey				= mkPreludeTyConUnique 71
threadIdPrimTyConKey			= mkPreludeTyConUnique 72
bcoPrimTyConKey				= mkPreludeTyConUnique 73
ptrTyConKey				= mkPreludeTyConUnique 74
funPtrTyConKey				= mkPreludeTyConUnique 75
788
789

-- Generic Type Constructors
apt's avatar
apt committed
790
791
792
crossTyConKey		      		= mkPreludeTyConUnique 79
plusTyConKey		      		= mkPreludeTyConUnique 80
genUnitTyConKey				= mkPreludeTyConUnique 81
793

chak's avatar
chak committed
794
795
796
-- Parallel array type constructor
parrTyConKey				= mkPreludeTyConUnique 82

sof's avatar
sof committed
797
798
799
-- dotnet interop
objectTyConKey				= mkPreludeTyConUnique 83

800
801
eitherTyConKey				= mkPreludeTyConUnique 84

802
803
804
---------------- Template Haskell -------------------
--	USES TyConUniques 100-119
-----------------------------------------------------
805

806
unitTyConKey = mkTupleTyConUnique Boxed 0
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
\end{code}

%************************************************************************
%*									*
\subsubsection[Uniques-prelude-DataCons]{@Uniques@ for wired-in @DataCons@}
%*									*
%************************************************************************

\begin{code}
charDataConKey				= mkPreludeDataConUnique  1
consDataConKey				= mkPreludeDataConUnique  2
doubleDataConKey			= mkPreludeDataConUnique  3
falseDataConKey				= mkPreludeDataConUnique  4
floatDataConKey				= mkPreludeDataConUnique  5
intDataConKey				= mkPreludeDataConUnique  6
smallIntegerDataConKey			= mkPreludeDataConUnique  7
largeIntegerDataConKey			= mkPreludeDataConUnique  8
824
825
826
827
828
829
nilDataConKey				= mkPreludeDataConUnique 11
ratioDataConKey				= mkPreludeDataConUnique 12
stableNameDataConKey			= mkPreludeDataConUnique 14
trueDataConKey				= mkPreludeDataConUnique 15
wordDataConKey				= mkPreludeDataConUnique 16
ioDataConKey				= mkPreludeDataConUnique 17
830
831

-- Generic data constructors
832
833
834
835
crossDataConKey		      		= mkPreludeDataConUnique 20
inlDataConKey		      		= mkPreludeDataConUnique 21
inrDataConKey		      		= mkPreludeDataConUnique 22
genUnitDataConKey			= mkPreludeDataConUnique 23
chak's avatar
chak committed
836
837
838

-- Data constructor for parallel arrays
parrDataConKey				= mkPreludeDataConUnique 24
839
840
841

leftDataConKey				= mkPreludeDataConUnique 25
rightDataConKey				= mkPreludeDataConUnique 26
842
843
844
845
846
847
848
849
850
851
852
\end{code}

%************************************************************************
%*									*
\subsubsection[Uniques-prelude-Ids]{@Uniques@ for wired-in @Ids@ (except @DataCons@)}
%*									*
%************************************************************************

\begin{code}
absentErrorIdKey	      = mkPreludeMiscIdUnique  1
augmentIdKey		      = mkPreludeMiscIdUnique  3
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
appendIdKey		      = mkPreludeMiscIdUnique  4
buildIdKey		      = mkPreludeMiscIdUnique  5
errorIdKey		      = mkPreludeMiscIdUnique  6
foldlIdKey		      = mkPreludeMiscIdUnique  7
foldrIdKey		      = mkPreludeMiscIdUnique  8
recSelErrorIdKey	      = mkPreludeMiscIdUnique  9
integerMinusOneIdKey	      = mkPreludeMiscIdUnique 10
integerPlusOneIdKey	      = mkPreludeMiscIdUnique 11
integerPlusTwoIdKey	      = mkPreludeMiscIdUnique 12
integerZeroIdKey	      = mkPreludeMiscIdUnique 13
int2IntegerIdKey	      = mkPreludeMiscIdUnique 14
seqIdKey		      = mkPreludeMiscIdUnique 15
irrefutPatErrorIdKey	      = mkPreludeMiscIdUnique 16
eqStringIdKey		      = mkPreludeMiscIdUnique 17
noMethodBindingErrorIdKey     = mkPreludeMiscIdUnique 18
nonExhaustiveGuardsErrorIdKey = mkPreludeMiscIdUnique 19
runtimeErrorIdKey	      = mkPreludeMiscIdUnique 20 
parErrorIdKey		      = mkPreludeMiscIdUnique 21
parIdKey		      = mkPreludeMiscIdUnique 22
patErrorIdKey		      = mkPreludeMiscIdUnique 23
realWorldPrimIdKey	      = mkPreludeMiscIdUnique 24
recConErrorIdKey	      = mkPreludeMiscIdUnique 25
recUpdErrorIdKey	      = mkPreludeMiscIdUnique 26
traceIdKey		      = mkPreludeMiscIdUnique 27
unpackCStringUtf8IdKey	      = mkPreludeMiscIdUnique 28
unpackCStringAppendIdKey      = mkPreludeMiscIdUnique 29
unpackCStringFoldrIdKey	      = mkPreludeMiscIdUnique 30
unpackCStringIdKey	      = mkPreludeMiscIdUnique 31

882
883
884
885
886
887
888
unsafeCoerceIdKey	      = mkPreludeMiscIdUnique 32
concatIdKey		      = mkPreludeMiscIdUnique 33
filterIdKey		      = mkPreludeMiscIdUnique 34
zipIdKey		      = mkPreludeMiscIdUnique 35
bindIOIdKey		      = mkPreludeMiscIdUnique 36
returnIOIdKey		      = mkPreludeMiscIdUnique 37
deRefStablePtrIdKey	      = mkPreludeMiscIdUnique 38
889
newStablePtrIdKey	      = mkPreludeMiscIdUnique 39
890
891
plusIntegerIdKey	      = mkPreludeMiscIdUnique 41
timesIntegerIdKey	      = mkPreludeMiscIdUnique 42
892
printIdKey		      = mkPreludeMiscIdUnique 43
893
failIOIdKey		      = mkPreludeMiscIdUnique 44
894
nullAddrIdKey		      = mkPreludeMiscIdUnique 46
895
voidArgIdKey		      = mkPreludeMiscIdUnique 47
896
897
898
splitIdKey		      = mkPreludeMiscIdUnique 48
fstIdKey		      = mkPreludeMiscIdUnique 49
sndIdKey		      = mkPreludeMiscIdUnique 50
899
900
901
902
otherwiseIdKey		      = mkPreludeMiscIdUnique 51
assertIdKey		      = mkPreludeMiscIdUnique 53
runSTRepIdKey		      = mkPreludeMiscIdUnique 54

903
rootMainKey		      = mkPreludeMiscIdUnique 55
904
runMainKey		      = mkPreludeMiscIdUnique 56
chak's avatar
chak committed
905
906
907

andIdKey		      = mkPreludeMiscIdUnique 57
orIdKey			      = mkPreludeMiscIdUnique 58
908
thenIOIdKey		      = mkPreludeMiscIdUnique 59
909
lazyIdKey		      = mkPreludeMiscIdUnique 60
910
assertErrorIdKey	      = mkPreludeMiscIdUnique 61
chak's avatar
chak committed
911
912

-- Parallel array functions
913
914
915
916
917
918
919
920
921
922
923
924
925
926
nullPIdKey	              = mkPreludeMiscIdUnique 80
lengthPIdKey		      = mkPreludeMiscIdUnique 81
replicatePIdKey		      = mkPreludeMiscIdUnique 82
mapPIdKey		      = mkPreludeMiscIdUnique 83
filterPIdKey		      = mkPreludeMiscIdUnique 84
zipPIdKey		      = mkPreludeMiscIdUnique 85
crossPIdKey		      = mkPreludeMiscIdUnique 86
indexPIdKey		      = mkPreludeMiscIdUnique 87
toPIdKey		      = mkPreludeMiscIdUnique 88
enumFromToPIdKey              = mkPreludeMiscIdUnique 89
enumFromThenToPIdKey          = mkPreludeMiscIdUnique 90
bpermutePIdKey		      = mkPreludeMiscIdUnique 91
bpermuteDftPIdKey	      = mkPreludeMiscIdUnique 92
indexOfPIdKey		      = mkPreludeMiscIdUnique 93
sof's avatar
sof committed
927
928
929
930
931
932
933
934

-- dotnet interop
unmarshalObjectIdKey          = mkPreludeMiscIdUnique 94
marshalObjectIdKey            = mkPreludeMiscIdUnique 95
marshalStringIdKey            = mkPreludeMiscIdUnique 96
unmarshalStringIdKey          = mkPreludeMiscIdUnique 97
checkDotnetResNameIdKey       = mkPreludeMiscIdUnique 98

935
936
937
938
939
940
\end{code}

Certain class operations from Prelude classes.  They get their own
uniques so we can look them up easily when we want to conjure them up
during type checking.

941
\begin{code}
942
943
	-- Just a place holder for  unbound variables  produced by the renamer:
unboundKey		      = mkPreludeMiscIdUnique 101 
944

945
946
947
948
949
950
951
952
953
fromIntegerClassOpKey	      = mkPreludeMiscIdUnique 102
minusClassOpKey		      = mkPreludeMiscIdUnique 103
fromRationalClassOpKey	      = mkPreludeMiscIdUnique 104
enumFromClassOpKey	      = mkPreludeMiscIdUnique 105
enumFromThenClassOpKey	      = mkPreludeMiscIdUnique 106
enumFromToClassOpKey	      = mkPreludeMiscIdUnique 107
enumFromThenToClassOpKey      = mkPreludeMiscIdUnique 108
eqClassOpKey		      = mkPreludeMiscIdUnique 109
geClassOpKey		      = mkPreludeMiscIdUnique 110
954
negateClassOpKey	      = mkPreludeMiscIdUnique 111
955
failMClassOpKey		      = mkPreludeMiscIdUnique 112
956
957
bindMClassOpKey		      = mkPreludeMiscIdUnique 113 -- (>>=)
thenMClassOpKey		      = mkPreludeMiscIdUnique 114 -- (>>)
958
returnMClassOpKey	      = mkPreludeMiscIdUnique 117
959

960
-- Recursive do notation
961
962
mfixIdKey	= mkPreludeMiscIdUnique 118

963
964
965
966
967
968
969
970
-- Arrow notation
arrAIdKey	= mkPreludeMiscIdUnique 119
composeAIdKey	= mkPreludeMiscIdUnique 120 -- >>>
firstAIdKey	= mkPreludeMiscIdUnique 121
appAIdKey	= mkPreludeMiscIdUnique 122
choiceAIdKey	= mkPreludeMiscIdUnique 123 -- |||
loopAIdKey	= mkPreludeMiscIdUnique 124

971
972
973
---------------- Template Haskell -------------------
--	USES IdUniques 200-299
-----------------------------------------------------
974
975
976
\end{code}


977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
%************************************************************************
%*									*
\subsection{Standard groups of types}
%*									*
%************************************************************************

\begin{code}
numericTyKeys = 
	[ addrTyConKey
	, wordTyConKey
	, intTyConKey
	, integerTyConKey
	, doubleTyConKey
	, floatTyConKey
	]

	-- Renamer always imports these data decls replete with constructors
	-- so that desugarer can always see their constructors.  Ugh!
cCallishTyKeys = 
	[ addrTyConKey
	, wordTyConKey
	, byteArrayTyConKey
	, mutableByteArrayTyConKey
	, stablePtrTyConKey
	, int8TyConKey
	, int16TyConKey
	, int32TyConKey
	, int64TyConKey
	, word8TyConKey
	, word16TyConKey
	, word32TyConKey
	, word64TyConKey
	]
\end{code}
1011
1012


1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
%************************************************************************
%*									*
\subsection[Class-std-groups]{Standard groups of Prelude classes}
%*									*
%************************************************************************

NOTE: @Eq@ and @Text@ do need to appear in @standardClasses@
even though every numeric class has these two as a superclass,
because the list of ambiguous dictionaries hasn't been simplified.

\begin{code}
numericClassKeys =
	[ numClassKey
    	, realClassKey
    	, integralClassKey
	]
	++ fractionalClassKeys

fractionalClassKeys = 
    	[ fractionalClassKey
    	, floatingClassKey
    	, realFracClassKey
    	, realFloatClassKey
    	]

	-- the strictness analyser needs to know about numeric types
	-- (see SaAbsInt.lhs)
needsDataDeclCtxtClassKeys = -- see comments in TcDeriv
  	[ readClassKey
    	]

1044
standardClassKeys = derivableClassKeys ++ numericClassKeys
1045

1046
noDictClassKeys = [] -- ToDo: remove?
1047
1048
\end{code}

1049
1050
1051
1052
1053
1054
1055
1056
1057
@derivableClassKeys@ is also used in checking \tr{deriving} constructs
(@TcDeriv@).

\begin{code}
derivableClassKeys
  = [ eqClassKey, ordClassKey, enumClassKey, ixClassKey,
      boundedClassKey, showClassKey, readClassKey ]
\end{code}