Unique.lhs 18.8 KB
Newer Older
1
%
2
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1996
3
%
4
\section[Unique]{The @Unique@ data type}
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

@Uniques@ are used to distinguish entities in the compiler (@Ids@,
@Classes@, etc.) from each other.  Thus, @Uniques@ are the basic
comparison key in the compiler.

If there is any single operation that needs to be fast, it is @Unique@
comparison.  Unsurprisingly, there is quite a bit of huff-and-puff
directed to that end.

Some of the other hair in this code is to be able to use a
``splittable @UniqueSupply@'' if requested/possible (not standard
Haskell).

\begin{code}
#include "HsVersions.h"

21
22
--<mkdependHS:friends> UniqSupply

23
module Unique (
24
	Unique,
25
26
	u2i,				-- hack: used in UniqFM

27
28
29
30
	pprUnique, pprUnique10, showUnique,

	mkUnique,			-- Used in UniqSupply
	mkUniqueGrimily,		-- Used in UniqSupply only!
31

32
33
34
	incrUnique,			-- Used for renumbering
	initRenumberingUniques,

35
36
	-- now all the built-in Uniques (and functions to make them)
	-- [the Oh-So-Wonderful Haskell module system wins again...]
37
	mkAlphaTyVarUnique,
38
39
	mkPrimOpIdUnique,
	mkTupleDataConUnique,
40
	mkTupleTyConUnique,
41

42
43
44
	getBuiltinUniques, mkBuiltinUnique,
	mkPseudoUnique1, mkPseudoUnique2, mkPseudoUnique3,

45
46
47
48
49
	absentErrorIdKey,	-- alphabetical...
	addrDataConKey,
	addrPrimTyConKey,
	addrTyConKey,
	appendIdKey,
50
	arrayPrimTyConKey,
51
	augmentIdKey,
52
	binaryClassKey,
53
	boolTyConKey,
54
	boundedClassKey,
55
56
57
58
59
60
61
62
	buildDataConKey,
	buildIdKey,
	byteArrayPrimTyConKey,
	cCallableClassKey,
	cReturnableClassKey,
	charDataConKey,
	charPrimTyConKey,
	charTyConKey,
63
	consDataConKey,
64
	evalClassKey,
65
66
67
	doubleDataConKey,
	doublePrimTyConKey,
	doubleTyConKey,
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
	enumClassKey,
	enumFromClassOpKey,
	enumFromThenClassOpKey,
	enumFromThenToClassOpKey,
	enumFromToClassOpKey,
	eqClassKey,
	eqClassOpKey,
	eqDataConKey,
	errorIdKey,
	falseDataConKey,
	floatDataConKey,
	floatPrimTyConKey,
	floatTyConKey,
	floatingClassKey,
	foldlIdKey,
	foldrIdKey,
84
85
	forkIdKey,
	fractionalClassKey,
86
87
88
89
90
91
	fromIntClassOpKey,
	fromIntegerClassOpKey,
	fromRationalClassOpKey,
	funTyConKey,
	geClassOpKey,
	gtDataConKey,
92
93
	iOTyConKey,
	intDataConKey,
94
95
96
97
98
99
100
101
102
	intPrimTyConKey,
	intTyConKey,
	integerDataConKey,
	integerMinusOneIdKey,
	integerPlusOneIdKey,
	integerPlusTwoIdKey,
	integerTyConKey,
	integerZeroIdKey,
	integralClassKey,
103
	ixClassKey,
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
	liftDataConKey,
	liftTyConKey,
	listTyConKey,
	ltDataConKey,
	mainIdKey,
	mainPrimIOIdKey,
	mallocPtrDataConKey,
	mallocPtrPrimTyConKey,
	mallocPtrTyConKey,
	monadClassKey,
	monadZeroClassKey,
	mutableArrayPrimTyConKey,
	mutableByteArrayPrimTyConKey,
	nilDataConKey,
	numClassKey,
	ordClassKey,
	orderingTyConKey,
	packCStringIdKey,
	parErrorIdKey,
	parIdKey,
124
	patErrorIdKey,
125
126
127
128
	recConErrorIdKey,
	recUpdErrorIdKey,
	irrefutPatErrorIdKey,
	nonExhaustiveGuardsErrorIdKey,
129
130
	noDefaultMethodErrorIdKey,
	nonExplicitMethodErrorIdKey,
131
132
133
	primIoTyConKey,
	ratioDataConKey,
	ratioTyConKey,
134
	rationalTyConKey,
135
136
137
	readClassKey,
	realClassKey,
	realFloatClassKey,
138
	realFracClassKey,
139
	realWorldPrimIdKey,
140
	realWorldTyConKey,
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
	return2GMPsDataConKey,
	return2GMPsTyConKey,
	returnIntAndGMPDataConKey,
	returnIntAndGMPTyConKey,
	runSTIdKey,
	seqIdKey,
	showClassKey,
	stTyConKey,
	stablePtrDataConKey,
	stablePtrPrimTyConKey,
	stablePtrTyConKey,
	stateAndAddrPrimDataConKey,
	stateAndAddrPrimTyConKey,
	stateAndArrayPrimDataConKey,
	stateAndArrayPrimTyConKey,
	stateAndByteArrayPrimDataConKey,
	stateAndByteArrayPrimTyConKey,
158
	stateAndCharPrimDataConKey,
159
160
161
162
163
	stateAndCharPrimTyConKey,
	stateAndDoublePrimDataConKey,
	stateAndDoublePrimTyConKey,
	stateAndFloatPrimDataConKey,
	stateAndFloatPrimTyConKey,
164
	stateAndIntPrimDataConKey,
165
	stateAndIntPrimTyConKey,
166
	stateAndMallocPtrPrimDataConKey,
167
	stateAndMallocPtrPrimTyConKey,
168
	stateAndMutableArrayPrimDataConKey,
169
	stateAndMutableArrayPrimTyConKey,
170
	stateAndMutableByteArrayPrimDataConKey,
171
172
173
174
175
	stateAndMutableByteArrayPrimTyConKey,
	stateAndPtrPrimDataConKey,
	stateAndPtrPrimTyConKey,
	stateAndStablePtrPrimDataConKey,
	stateAndStablePtrPrimTyConKey,
176
	stateAndSynchVarPrimDataConKey,
177
178
179
180
181
182
	stateAndSynchVarPrimTyConKey,
	stateAndWordPrimDataConKey,
	stateAndWordPrimTyConKey,
	stateDataConKey,
	statePrimTyConKey,
	stateTyConKey,
183
	stringTyConKey,
184
	synchVarPrimTyConKey,
185
186
	traceIdKey,
	trueDataConKey,
187
188
189
190
	unpackCString2IdKey,
	unpackCStringAppendIdKey,
	unpackCStringFoldrIdKey,
	unpackCStringIdKey,
191
	voidPrimIdKey,
192
193
194
195
196
197
198
199
200
	voidPrimTyConKey,
	wordDataConKey,
	wordPrimTyConKey,
	wordTyConKey
#ifdef GRAN
	, copyableIdKey
	, noFollowIdKey
	, parGlobalIdKey
	, parLocalIdKey
201
#endif
202
	-- to make interface self-sufficient
203
204
205
206
    ) where

import PreludeGlaST

207
208
209
210
import Ubiq{-uitous-}

import Pretty
import Util
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
\end{code}

%************************************************************************
%*									*
\subsection[Unique-type]{@Unique@ type and operations}
%*									*
%************************************************************************

The @Chars@ are ``tag letters'' that identify the @UniqueSupply@.
Fast comparison is everything on @Uniques@:

\begin{code}
u2i :: Unique -> FAST_INT

data Unique = MkUnique Int#
u2i (MkUnique i) = i
\end{code}

Now come the functions which construct uniques from their pieces, and vice versa.
The stuff about unique *supplies* is handled further down this module.

\begin{code}
233
234
mkUnique	:: Char -> Int -> Unique	-- Builds a unique from pieces
unpkUnique	:: Unique -> (Char, Int)	-- The reverse
235

236
mkUniqueGrimily :: Int# -> Unique		-- A trap-door for UniqSupply
237
238

incrUnique	:: Unique -> Unique
239
240
241
242
243
244
\end{code}


\begin{code}
mkUniqueGrimily x = MkUnique x

245
incrUnique (MkUnique i) = MkUnique (i +# 1#)
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296

-- pop the Char in the top 8 bits of the Unique(Supply)

-- No 64-bit bugs here, as long as we have at least 32 bits. --JSM

w2i x = word2Int# x
i2w x = int2Word# x
i2w_s x = (x::Int#)

mkUnique (MkChar c#) (MkInt i#)
  = MkUnique (w2i (((i2w (ord# c#)) `shiftL#` (i2w_s 24#)) `or#` (i2w i#)))

unpkUnique (MkUnique u)
  = let
	tag = MkChar (chr# (w2i ((i2w u) `shiftr` (i2w_s 24#))))
	i   = MkInt  (w2i ((i2w u) `and#` (i2w 16777215#){-``0x00ffffff''-}))
    in
    (tag, i)
  where
    shiftr x y = shiftRA# x y
\end{code}

%************************************************************************
%*									*
\subsection[Unique-instances]{Instance declarations for @Unique@}
%*									*
%************************************************************************

And the whole point (besides uniqueness) is fast equality.  We don't
use `deriving' because we want {\em precise} control of ordering
(equality on @Uniques@ is v common).

\begin{code}
eqUnique (MkUnique u1) (MkUnique u2) = u1 ==# u2
ltUnique (MkUnique u1) (MkUnique u2) = u1 <#  u2
leUnique (MkUnique u1) (MkUnique u2) = u1 <=# u2

cmpUnique (MkUnique u1) (MkUnique u2)
  = if u1 ==# u2 then EQ_ else if u1 <# u2 then LT_ else GT_

instance Eq Unique where
    a == b = eqUnique a b
    a /= b = not (eqUnique a b)

instance Ord Unique where
    a  < b = ltUnique a b
    a <= b = leUnique a b
    a  > b = not (leUnique a b)
    a >= b = not (ltUnique a b)
    _tagCmp a b = case cmpUnique a b of { LT_ -> _LT; EQ_ -> _EQ; GT__ -> _GT }

297
298
299
instance Ord3 Unique where
    cmp = cmpUnique

300
301
302
-----------------
instance Uniquable Unique where
    uniqueOf u = u
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
\end{code}

We do sometimes make strings with @Uniques@ in them:
\begin{code}
pprUnique, pprUnique10 :: Unique -> Pretty

pprUnique uniq
  = case unpkUnique uniq of
      (tag, u) -> ppBeside (ppChar tag) (iToBase62 u)

pprUnique10 uniq	-- in base-10, dudes
  = case unpkUnique uniq of
      (tag, u) -> ppBeside (ppChar tag) (ppInt u)

showUnique :: Unique -> FAST_STRING
showUnique uniq = _PK_ (ppShow 80 (pprUnique uniq))

320
321
322
instance Outputable Unique where
    ppr sty u = pprUnique u

323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
instance Text Unique where
    showsPrec p uniq rest = _UNPK_ (showUnique uniq)
    readsPrec p = panic "no readsPrec for Unique"
\end{code}

%************************************************************************
%*									*
\subsection[Utils-base62]{Base-62 numbers}
%*									*
%************************************************************************

A character-stingy way to read/write numbers (notably Uniques).
The ``62-its'' are \tr{[0-9a-zA-Z]}.  We don't handle negative Ints.
Code stolen from Lennart.
\begin{code}
iToBase62 :: Int -> Pretty

iToBase62 n@(I# n#)
  = ASSERT(n >= 0)
    let
	bytes = case chars62 of { _ByteArray bounds_who_needs_'em bytes -> bytes }
    in
345
    if n# <# 62# then
346
347
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
375
376
	case (indexCharArray# bytes n#) of { c ->
	ppChar (C# c) }
    else
	case (quotRem n 62)		of { (q, I# r#) ->
	case (indexCharArray# bytes r#) of { c  ->
	ppBeside (iToBase62 q) (ppChar (C# c)) }}

-- keep this at top level! (bug on 94/10/24 WDP)
chars62 :: _ByteArray Int
chars62
  = _runST (
	newCharArray (0, 61)	`thenStrictlyST` \ ch_array ->
	fill_in ch_array 0 62 "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
				`seqStrictlyST`
	unsafeFreezeByteArray ch_array
    )
  where
    fill_in ch_array i lim str
      | i == lim
      = returnStrictlyST ()
      | otherwise
      = writeCharArray ch_array i (str !! i)	`seqStrictlyST`
	fill_in ch_array (i+1) lim str
\end{code}

%************************************************************************
%*									*
\subsection[Uniques-prelude]{@Uniques@ for wired-in Prelude things}
%*									*
%************************************************************************

377
Allocation of unique supply characters:
378
379
380
381
	v,t,u : for renumbering value-, type- and usage- vars.
	other a-z: lower case chars for unique supplies (see Main.lhs)
	B:   builtin
	C-E: pseudo uniques	(used in native-code generator)
382
383
384
	_:   unifiable tyvars   (above)
	1-8: prelude things below

385
\begin{code}
386
387
388
389
390
391
392
393
394
395
396
mkAlphaTyVarUnique i		= mkUnique '1' i

mkPreludeClassUnique i		= mkUnique '2' i
mkPreludeTyConUnique i		= mkUnique '3' i
mkTupleTyConUnique a		= mkUnique '4' a

mkPreludeDataConUnique i	= mkUnique '5' i 	-- must be alphabetic
mkTupleDataConUnique a		= mkUnique '6' a	-- ditto (*may* be used in C labels)

mkPrimOpIdUnique op		= mkUnique '7' op
mkPreludeMiscIdUnique i		= mkUnique '8' i
397
398
399
400
401
402
403
404
405
406
407
408
409

initRenumberingUniques = (mkUnique 'v' 1, mkUnique 't' 1, mkUnique 'u' 1)

mkPseudoUnique1, mkPseudoUnique2, mkPseudoUnique3,
 mkBuiltinUnique :: Int -> Unique

mkBuiltinUnique i = mkUnique 'B' i
mkPseudoUnique1 i = mkUnique 'C' i -- used for uniqueOf on Regs
mkPseudoUnique2 i = mkUnique 'D' i -- ditto
mkPseudoUnique3 i = mkUnique 'E' i -- ditto

getBuiltinUniques :: Int -> [Unique]
getBuiltinUniques n = map (mkUnique 'B') [1 .. n]
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
\end{code}

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

\begin{code}
eqClassKey		= mkPreludeClassUnique 1
ordClassKey		= mkPreludeClassUnique 2
numClassKey		= mkPreludeClassUnique 3
integralClassKey	= mkPreludeClassUnique 4
fractionalClassKey	= mkPreludeClassUnique 5
floatingClassKey	= mkPreludeClassUnique 6
realClassKey		= mkPreludeClassUnique 7
realFracClassKey	= mkPreludeClassUnique 8
realFloatClassKey	= mkPreludeClassUnique 9
ixClassKey		= mkPreludeClassUnique 10
enumClassKey		= mkPreludeClassUnique 11
430
431
432
433
434
435
436
showClassKey		= mkPreludeClassUnique 12
readClassKey		= mkPreludeClassUnique 13
monadClassKey		= mkPreludeClassUnique 14
monadZeroClassKey	= mkPreludeClassUnique 15
binaryClassKey		= mkPreludeClassUnique 16
cCallableClassKey	= mkPreludeClassUnique 17	
cReturnableClassKey	= mkPreludeClassUnique 18
437
438
evalClassKey		= mkPreludeClassUnique 19
boundedClassKey		= mkPreludeClassUnique 20
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
\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
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
doublePrimTyConKey			= mkPreludeTyConUnique  9
doubleTyConKey				= mkPreludeTyConUnique 10 
floatPrimTyConKey			= mkPreludeTyConUnique 11
floatTyConKey				= mkPreludeTyConUnique 12
funTyConKey				= mkPreludeTyConUnique 13
iOTyConKey				= mkPreludeTyConUnique 14
intPrimTyConKey				= mkPreludeTyConUnique 15
intTyConKey				= mkPreludeTyConUnique 16
integerTyConKey				= mkPreludeTyConUnique 17
liftTyConKey				= mkPreludeTyConUnique 18
listTyConKey				= mkPreludeTyConUnique 19
mallocPtrPrimTyConKey			= mkPreludeTyConUnique 20
mallocPtrTyConKey			= mkPreludeTyConUnique 21
mutableArrayPrimTyConKey		= mkPreludeTyConUnique 22
mutableByteArrayPrimTyConKey		= mkPreludeTyConUnique 23
orderingTyConKey			= mkPreludeTyConUnique 24
synchVarPrimTyConKey		    	= mkPreludeTyConUnique 25
ratioTyConKey				= mkPreludeTyConUnique 26
rationalTyConKey			= mkPreludeTyConUnique 27
realWorldTyConKey			= mkPreludeTyConUnique 28
return2GMPsTyConKey			= mkPreludeTyConUnique 29
returnIntAndGMPTyConKey			= mkPreludeTyConUnique 30
stablePtrPrimTyConKey			= mkPreludeTyConUnique 31
stablePtrTyConKey			= mkPreludeTyConUnique 32
stateAndAddrPrimTyConKey		= mkPreludeTyConUnique 33
stateAndArrayPrimTyConKey		= mkPreludeTyConUnique 34
stateAndByteArrayPrimTyConKey		= mkPreludeTyConUnique 35
stateAndCharPrimTyConKey		= mkPreludeTyConUnique 36
stateAndDoublePrimTyConKey		= mkPreludeTyConUnique 37
stateAndFloatPrimTyConKey		= mkPreludeTyConUnique 38
stateAndIntPrimTyConKey			= mkPreludeTyConUnique 39
stateAndMallocPtrPrimTyConKey		= mkPreludeTyConUnique 40
stateAndMutableArrayPrimTyConKey	= mkPreludeTyConUnique 41
stateAndMutableByteArrayPrimTyConKey	= mkPreludeTyConUnique 42
stateAndSynchVarPrimTyConKey	    	= mkPreludeTyConUnique 43
stateAndPtrPrimTyConKey			= mkPreludeTyConUnique 44
stateAndStablePtrPrimTyConKey		= mkPreludeTyConUnique 45
stateAndWordPrimTyConKey		= mkPreludeTyConUnique 46
statePrimTyConKey			= mkPreludeTyConUnique 47
stateTyConKey				= mkPreludeTyConUnique 48
stringTyConKey				= mkPreludeTyConUnique 49
stTyConKey				= mkPreludeTyConUnique 50
primIoTyConKey				= mkPreludeTyConUnique 51
voidPrimTyConKey			= mkPreludeTyConUnique 52
wordPrimTyConKey			= mkPreludeTyConUnique 53
wordTyConKey				= mkPreludeTyConUnique 54
501
502
503
504
505
506
507
508
509
510
511
512
513
514
\end{code}

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

\begin{code}
addrDataConKey				= mkPreludeDataConUnique  1
buildDataConKey				= mkPreludeDataConUnique  2
charDataConKey				= mkPreludeDataConUnique  4
consDataConKey				= mkPreludeDataConUnique  5
doubleDataConKey			= mkPreludeDataConUnique  6
515
eqDataConKey				= mkPreludeDataConUnique  7
516
517
falseDataConKey				= mkPreludeDataConUnique  8
floatDataConKey				= mkPreludeDataConUnique  9
518
gtDataConKey				= mkPreludeDataConUnique 10
519
520
521
intDataConKey				= mkPreludeDataConUnique 11
integerDataConKey			= mkPreludeDataConUnique 12
liftDataConKey				= mkPreludeDataConUnique 13
522
ltDataConKey				= mkPreludeDataConUnique 14
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
mallocPtrDataConKey			= mkPreludeDataConUnique 15
nilDataConKey				= mkPreludeDataConUnique 18
ratioDataConKey				= mkPreludeDataConUnique 21
return2GMPsDataConKey			= mkPreludeDataConUnique 22
returnIntAndGMPDataConKey		= mkPreludeDataConUnique 23
stablePtrDataConKey			= mkPreludeDataConUnique 24
stateAndAddrPrimDataConKey		= mkPreludeDataConUnique 25
stateAndArrayPrimDataConKey		= mkPreludeDataConUnique 26
stateAndByteArrayPrimDataConKey		= mkPreludeDataConUnique 27
stateAndCharPrimDataConKey		= mkPreludeDataConUnique 28
stateAndDoublePrimDataConKey		= mkPreludeDataConUnique 29
stateAndFloatPrimDataConKey		= mkPreludeDataConUnique 30
stateAndIntPrimDataConKey		= mkPreludeDataConUnique 31
stateAndMallocPtrPrimDataConKey		= mkPreludeDataConUnique 32
stateAndMutableArrayPrimDataConKey	= mkPreludeDataConUnique 33
stateAndMutableByteArrayPrimDataConKey	= mkPreludeDataConUnique 34
stateAndSynchVarPrimDataConKey	    	= mkPreludeDataConUnique 35
stateAndPtrPrimDataConKey		= mkPreludeDataConUnique 36
stateAndStablePtrPrimDataConKey		= mkPreludeDataConUnique 37
stateAndWordPrimDataConKey		= mkPreludeDataConUnique 38
stateDataConKey				= mkPreludeDataConUnique 39
trueDataConKey				= mkPreludeDataConUnique 40
wordDataConKey				= mkPreludeDataConUnique 41
\end{code}

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

\begin{code}
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
absentErrorIdKey	      = mkPreludeMiscIdUnique  1
appendIdKey 		      = mkPreludeMiscIdUnique  2
augmentIdKey		      = mkPreludeMiscIdUnique  3
buildIdKey		      = mkPreludeMiscIdUnique  4
errorIdKey		      = mkPreludeMiscIdUnique  5
foldlIdKey		      = mkPreludeMiscIdUnique  6
foldrIdKey		      = mkPreludeMiscIdUnique  7
forkIdKey   	    	      = mkPreludeMiscIdUnique  8
int2IntegerIdKey	      = mkPreludeMiscIdUnique  9
integerMinusOneIdKey	      = mkPreludeMiscIdUnique 10
integerPlusOneIdKey	      = mkPreludeMiscIdUnique 11
integerPlusTwoIdKey	      = mkPreludeMiscIdUnique 12
integerZeroIdKey	      = mkPreludeMiscIdUnique 13
packCStringIdKey	      = mkPreludeMiscIdUnique 14
parErrorIdKey		      = mkPreludeMiscIdUnique 15
parIdKey		      = mkPreludeMiscIdUnique 16
patErrorIdKey		      = mkPreludeMiscIdUnique 17
realWorldPrimIdKey	      = mkPreludeMiscIdUnique 18
runSTIdKey		      = mkPreludeMiscIdUnique 19
seqIdKey		      = mkPreludeMiscIdUnique 20
traceIdKey		      = mkPreludeMiscIdUnique 21
unpackCString2IdKey	      = mkPreludeMiscIdUnique 22
unpackCStringAppendIdKey      = mkPreludeMiscIdUnique 23
unpackCStringFoldrIdKey	      = mkPreludeMiscIdUnique 24
unpackCStringIdKey	      = mkPreludeMiscIdUnique 25
voidPrimIdKey		      = mkPreludeMiscIdUnique 26
mainIdKey		      = mkPreludeMiscIdUnique 27
mainPrimIOIdKey		      = mkPreludeMiscIdUnique 28
recConErrorIdKey	      = mkPreludeMiscIdUnique 29
recUpdErrorIdKey	      = mkPreludeMiscIdUnique 30
irrefutPatErrorIdKey	      = mkPreludeMiscIdUnique 31
nonExhaustiveGuardsErrorIdKey = mkPreludeMiscIdUnique 32
587
588
noDefaultMethodErrorIdKey     = mkPreludeMiscIdUnique 33
nonExplicitMethodErrorIdKey   = mkPreludeMiscIdUnique 34
589
590

#ifdef GRAN
591
592
593
594
parLocalIdKey		= mkPreludeMiscIdUnique 35
parGlobalIdKey		= mkPreludeMiscIdUnique 36
noFollowIdKey		= mkPreludeMiscIdUnique 37
copyableIdKey		= mkPreludeMiscIdUnique 38
595
596
597
#endif
\end{code}

598
599
600
601
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.        
\begin{code}					  
602
603
604
605
606
607
608
609
610
fromIntClassOpKey	= mkPreludeMiscIdUnique 37
fromIntegerClassOpKey	= mkPreludeMiscIdUnique 38
fromRationalClassOpKey	= mkPreludeMiscIdUnique 39
enumFromClassOpKey	= mkPreludeMiscIdUnique 40
enumFromThenClassOpKey	= mkPreludeMiscIdUnique 41
enumFromToClassOpKey	= mkPreludeMiscIdUnique 42
enumFromThenToClassOpKey= mkPreludeMiscIdUnique 43
eqClassOpKey		= mkPreludeMiscIdUnique 44
geClassOpKey		= mkPreludeMiscIdUnique 45
611
\end{code}