MonadFail proposal, phase 1
[ghc.git] / compiler / prelude / PrelNames.hs
1 {-
2 (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
3
4 \section[PrelNames]{Definitions of prelude modules and names}
5
6
7 Nota Bene: all Names defined in here should come from the base package
8
9 - ModuleNames for prelude modules,
10 e.g. pREL_BASE_Name :: ModuleName
11
12 - Modules for prelude modules
13 e.g. pREL_Base :: Module
14
15 - Uniques for Ids, DataCons, TyCons and Classes that the compiler
16 "knows about" in some way
17 e.g. intTyConKey :: Unique
18 minusClassOpKey :: Unique
19
20 - Names for Ids, DataCons, TyCons and Classes that the compiler
21 "knows about" in some way
22 e.g. intTyConName :: Name
23 minusName :: Name
24 One of these Names contains
25 (a) the module and occurrence name of the thing
26 (b) its Unique
27 The may way the compiler "knows about" one of these things is
28 where the type checker or desugarer needs to look it up. For
29 example, when desugaring list comprehensions the desugarer
30 needs to conjure up 'foldr'. It does this by looking up
31 foldrName in the environment.
32
33 - RdrNames for Ids, DataCons etc that the compiler may emit into
34 generated code (e.g. for deriving). It's not necessary to know
35 the uniques for these guys, only their names
36
37
38 Note [Known-key names]
39 ~~~~~~~~~~~~~~~~~~~~~~
40 It is *very* important that the compiler gives wired-in things and
41 things with "known-key" names the correct Uniques wherever they
42 occur. We have to be careful about this in exactly two places:
43
44 1. When we parse some source code, renaming the AST better yield an
45 AST whose Names have the correct uniques
46
47 2. When we read an interface file, the read-in gubbins better have
48 the right uniques
49
50 This is accomplished through a combination of mechanisms:
51
52 1. When parsing source code, the RdrName-decorated AST has some
53 RdrNames which are Exact. These are wired-in RdrNames where the
54 we could directly tell from the parsed syntax what Name to
55 use. For example, when we parse a [] in a type we can just insert
56 an Exact RdrName Name with the listTyConKey.
57
58 Currently, I believe this is just an optimisation: it would be
59 equally valid to just output Orig RdrNames that correctly record
60 the module etc we expect the final Name to come from. However,
61 were we to eliminate isBuiltInOcc_maybe it would become essential
62 (see point 3).
63
64 2. The knownKeyNames (which consist of the basicKnownKeyNames from
65 the module, and those names reachable via the wired-in stuff from
66 TysWiredIn) are used to initialise the "OrigNameCache" in
67 IfaceEnv. This initialization ensures that when the type checker
68 or renamer (both of which use IfaceEnv) look up an original name
69 (i.e. a pair of a Module and an OccName) for a known-key name
70 they get the correct Unique.
71
72 This is the most important mechanism for ensuring that known-key
73 stuff gets the right Unique, and is why it is so important to
74 place your known-key names in the appropriate lists.
75
76 3. For "infinite families" of known-key names (i.e. tuples), we have
77 to be extra careful. Because there are an infinite number of
78 these things, we cannot add them to the list of known-key names
79 used to initialise the OrigNameCache. Instead, we have to
80 rely on never having to look them up in that cache.
81
82 This is accomplished through a variety of mechanisms:
83
84 a) The parser recognises them specially and generates an
85 Exact Name (hence not looked up in the orig-name cache)
86
87 b) The known infinite families of names are specially
88 serialised by BinIface.putName, with that special treatment
89 detected when we read back to ensure that we get back to the
90 correct uniques.
91
92 Most of the infinite families cannot occur in source code,
93 so mechanisms (a,b) sufficies to ensure that they always have
94 the right Unique. In particular, implicit param TyCon names,
95 constraint tuples and Any TyCons cannot be mentioned by the
96 user.
97
98 c) IfaceEnv.lookupOrigNameCache uses isBuiltInOcc_maybe to map
99 built-in syntax directly onto the corresponding name, rather
100 than trying to find it in the original-name cache.
101
102 See also Note [Built-in syntax and the OrigNameCache]
103 -}
104
105 {-# LANGUAGE CPP #-}
106
107 module PrelNames (
108 Unique, Uniquable(..), hasKey, -- Re-exported for convenience
109
110 -----------------------------------------------------------
111 module PrelNames, -- A huge bunch of (a) Names, e.g. intTyConName
112 -- (b) Uniques e.g. intTyConKey
113 -- (c) Groups of classes and types
114 -- (d) miscellaneous things
115 -- So many that we export them all
116 ) where
117
118 #include "HsVersions.h"
119
120 import Module
121 import OccName
122 import RdrName
123 import Unique
124 import Name
125 import SrcLoc
126 import FastString
127 import Config ( cIntegerLibraryType, IntegerLibrary(..) )
128 import Panic ( panic )
129
130 {-
131 ************************************************************************
132 * *
133 allNameStrings
134 * *
135 ************************************************************************
136 -}
137
138 allNameStrings :: [String]
139 -- Infinite list of a,b,c...z, aa, ab, ac, ... etc
140 allNameStrings = [ c:cs | cs <- "" : allNameStrings, c <- ['a'..'z'] ]
141
142 {-
143 ************************************************************************
144 * *
145 \subsection{Local Names}
146 * *
147 ************************************************************************
148
149 This *local* name is used by the interactive stuff
150 -}
151
152 itName :: Unique -> SrcSpan -> Name
153 itName uniq loc = mkInternalName uniq (mkOccNameFS varName (fsLit "it")) loc
154
155 -- mkUnboundName makes a place-holder Name; it shouldn't be looked at except possibly
156 -- during compiler debugging.
157 mkUnboundName :: RdrName -> Name
158 mkUnboundName rdr_name = mkInternalName unboundKey (rdrNameOcc rdr_name) noSrcSpan
159
160 isUnboundName :: Name -> Bool
161 isUnboundName name = name `hasKey` unboundKey
162
163 {-
164 ************************************************************************
165 * *
166 \subsection{Known key Names}
167 * *
168 ************************************************************************
169
170 This section tells what the compiler knows about the association of
171 names with uniques. These ones are the *non* wired-in ones. The
172 wired in ones are defined in TysWiredIn etc.
173 -}
174
175 basicKnownKeyNames :: [Name]
176 basicKnownKeyNames
177 = genericTyConNames
178 ++ [ -- Classes. *Must* include:
179 -- classes that are grabbed by key (e.g., eqClassKey)
180 -- classes in "Class.standardClassKeys" (quite a few)
181 eqClassName, -- mentioned, derivable
182 ordClassName, -- derivable
183 boundedClassName, -- derivable
184 numClassName, -- mentioned, numeric
185 enumClassName, -- derivable
186 monadClassName,
187 functorClassName,
188 realClassName, -- numeric
189 integralClassName, -- numeric
190 fractionalClassName, -- numeric
191 floatingClassName, -- numeric
192 realFracClassName, -- numeric
193 realFloatClassName, -- numeric
194 dataClassName,
195 isStringClassName,
196 applicativeClassName,
197 alternativeClassName,
198 foldableClassName,
199 traversableClassName,
200
201 -- The IO type
202 -- See Note [TyConRepNames for non-wired-in TyCons]
203 ioTyConName, ioDataConName,
204 runMainIOName,
205
206 -- Typeable
207 typeableClassName,
208 typeRepTyConName,
209 trTyConDataConName,
210 trModuleDataConName,
211 trNameSDataConName,
212 typeRepIdName,
213 mkPolyTyConAppName,
214 mkAppTyName,
215 typeSymbolTypeRepName, typeNatTypeRepName,
216
217 -- Dynamic
218 toDynName,
219
220 -- Numeric stuff
221 negateName, minusName, geName, eqName,
222
223 -- Conversion functions
224 rationalTyConName,
225 ratioTyConName, ratioDataConName,
226 fromRationalName, fromIntegerName,
227 toIntegerName, toRationalName,
228 fromIntegralName, realToFracName,
229
230 -- String stuff
231 fromStringName,
232
233 -- Enum stuff
234 enumFromName, enumFromThenName,
235 enumFromThenToName, enumFromToName,
236
237 -- Applicative/Alternative stuff
238 pureAName,
239 apAName,
240
241 -- Monad stuff
242 thenIOName, bindIOName, returnIOName, failIOName, bindMName, thenMName,
243 returnMName, fmapName, joinMName,
244
245 -- MonadFail
246 monadFailClassName, failMName, failMName_preMFP,
247
248 -- MonadFix
249 monadFixClassName, mfixName,
250
251 -- Arrow stuff
252 arrAName, composeAName, firstAName,
253 appAName, choiceAName, loopAName,
254
255 -- Ix stuff
256 ixClassName,
257
258 -- Show stuff
259 showClassName,
260
261 -- Read stuff
262 readClassName,
263
264 -- Stable pointers
265 newStablePtrName,
266
267 -- GHC Extensions
268 groupWithName,
269
270 -- Strings and lists
271 unpackCStringName,
272 unpackCStringFoldrName, unpackCStringUtf8Name,
273
274 -- Overloaded lists
275 isListClassName,
276 fromListName,
277 fromListNName,
278 toListName,
279
280 -- List operations
281 concatName, filterName, mapName,
282 zipName, foldrName, buildName, augmentName, appendName,
283
284 -- FFI primitive types that are not wired-in.
285 stablePtrTyConName, ptrTyConName, funPtrTyConName,
286 int8TyConName, int16TyConName, int32TyConName, int64TyConName,
287 word16TyConName, word32TyConName, word64TyConName,
288
289 -- Others
290 otherwiseIdName, inlineIdName,
291 eqStringName, assertName, breakpointName, breakpointCondName,
292 breakpointAutoName, opaqueTyConName,
293 assertErrorName,
294 printName, fstName, sndName,
295
296 -- Integer
297 integerTyConName, mkIntegerName,
298 integerToWord64Name, integerToInt64Name,
299 word64ToIntegerName, int64ToIntegerName,
300 plusIntegerName, timesIntegerName, smallIntegerName,
301 wordToIntegerName,
302 integerToWordName, integerToIntName, minusIntegerName,
303 negateIntegerName, eqIntegerPrimName, neqIntegerPrimName,
304 absIntegerName, signumIntegerName,
305 leIntegerPrimName, gtIntegerPrimName, ltIntegerPrimName, geIntegerPrimName,
306 compareIntegerName, quotRemIntegerName, divModIntegerName,
307 quotIntegerName, remIntegerName, divIntegerName, modIntegerName,
308 floatFromIntegerName, doubleFromIntegerName,
309 encodeFloatIntegerName, encodeDoubleIntegerName,
310 decodeDoubleIntegerName,
311 gcdIntegerName, lcmIntegerName,
312 andIntegerName, orIntegerName, xorIntegerName, complementIntegerName,
313 shiftLIntegerName, shiftRIntegerName, bitIntegerName,
314
315 -- Float/Double
316 rationalToFloatName,
317 rationalToDoubleName,
318
319 -- Other classes
320 randomClassName, randomGenClassName, monadPlusClassName,
321
322 -- Type-level naturals
323 knownNatClassName, knownSymbolClassName,
324
325 -- Overloaded labels
326 isLabelClassName,
327
328 -- Source locations
329 callStackDataConName, callStackTyConName,
330 srcLocDataConName,
331
332 -- Annotation type checking
333 toAnnotationWrapperName
334
335 -- The Ordering type
336 , orderingTyConName
337 , ltDataConName, eqDataConName, gtDataConName
338
339 -- The SPEC type for SpecConstr
340 , specTyConName
341
342 -- The Either type
343 , eitherTyConName, leftDataConName, rightDataConName
344
345 -- Plugins
346 , pluginTyConName
347
348 -- Generics
349 , genClassName, gen1ClassName
350 , datatypeClassName, constructorClassName, selectorClassName
351
352 -- Monad comprehensions
353 , guardMName
354 , liftMName
355 , mzipName
356
357 -- GHCi Sandbox
358 , ghciIoClassName, ghciStepIoMName
359
360 -- StaticPtr
361 , staticPtrTyConName
362 , staticPtrDataConName, staticPtrInfoDataConName
363
364 -- Fingerprint
365 , fingerprintDataConName
366
367 -- Custom type errors
368 , errorMessageTypeErrorFamName
369 , typeErrorTextDataConName
370 , typeErrorAppendDataConName
371 , typeErrorVAppendDataConName
372 , typeErrorShowTypeDataConName
373
374 ] ++ case cIntegerLibraryType of
375 IntegerGMP -> [integerSDataConName]
376 IntegerSimple -> []
377
378 genericTyConNames :: [Name]
379 genericTyConNames = [
380 v1TyConName, u1TyConName, par1TyConName, rec1TyConName,
381 k1TyConName, m1TyConName, sumTyConName, prodTyConName,
382 compTyConName, rTyConName, pTyConName, dTyConName,
383 cTyConName, sTyConName, rec0TyConName, par0TyConName,
384 d1TyConName, c1TyConName, s1TyConName, noSelTyConName,
385 repTyConName, rep1TyConName, uRecTyConName,
386 uAddrTyConName, uCharTyConName, uDoubleTyConName,
387 uFloatTyConName, uIntTyConName, uWordTyConName
388 ]
389
390 {-
391 ************************************************************************
392 * *
393 \subsection{Module names}
394 * *
395 ************************************************************************
396
397
398 --MetaHaskell Extension Add a new module here
399 -}
400
401 pRELUDE :: Module
402 pRELUDE = mkBaseModule_ pRELUDE_NAME
403
404 gHC_PRIM, gHC_TYPES, gHC_GENERICS, gHC_MAGIC,
405 gHC_CLASSES, gHC_BASE, gHC_ENUM, gHC_GHCI, gHC_CSTRING,
406 gHC_SHOW, gHC_READ, gHC_NUM, gHC_INTEGER_TYPE, gHC_LIST,
407 gHC_TUPLE, dATA_TUPLE, dATA_EITHER, dATA_STRING, dATA_FOLDABLE, dATA_TRAVERSABLE, dATA_MONOID,
408 gHC_CONC, gHC_IO, gHC_IO_Exception,
409 gHC_ST, gHC_ARR, gHC_STABLE, gHC_PTR, gHC_ERR, gHC_REAL,
410 gHC_FLOAT, gHC_TOP_HANDLER, sYSTEM_IO, dYNAMIC,
411 tYPEABLE, tYPEABLE_INTERNAL, gENERICS,
412 rEAD_PREC, lEX, gHC_INT, gHC_WORD, mONAD, mONAD_FIX, mONAD_ZIP, mONAD_FAIL,
413 aRROW, cONTROL_APPLICATIVE, gHC_DESUGAR, rANDOM, gHC_EXTS,
414 cONTROL_EXCEPTION_BASE, gHC_TYPELITS :: Module
415
416 gHC_PRIM = mkPrimModule (fsLit "GHC.Prim") -- Primitive types and values
417 gHC_TYPES = mkPrimModule (fsLit "GHC.Types")
418 gHC_MAGIC = mkPrimModule (fsLit "GHC.Magic")
419 gHC_CSTRING = mkPrimModule (fsLit "GHC.CString")
420 gHC_CLASSES = mkPrimModule (fsLit "GHC.Classes")
421
422 gHC_BASE = mkBaseModule (fsLit "GHC.Base")
423 gHC_ENUM = mkBaseModule (fsLit "GHC.Enum")
424 gHC_GHCI = mkBaseModule (fsLit "GHC.GHCi")
425 gHC_SHOW = mkBaseModule (fsLit "GHC.Show")
426 gHC_READ = mkBaseModule (fsLit "GHC.Read")
427 gHC_NUM = mkBaseModule (fsLit "GHC.Num")
428 gHC_INTEGER_TYPE= mkIntegerModule (fsLit "GHC.Integer.Type")
429 gHC_LIST = mkBaseModule (fsLit "GHC.List")
430 gHC_TUPLE = mkPrimModule (fsLit "GHC.Tuple")
431 dATA_TUPLE = mkBaseModule (fsLit "Data.Tuple")
432 dATA_EITHER = mkBaseModule (fsLit "Data.Either")
433 dATA_STRING = mkBaseModule (fsLit "Data.String")
434 dATA_FOLDABLE = mkBaseModule (fsLit "Data.Foldable")
435 dATA_TRAVERSABLE= mkBaseModule (fsLit "Data.Traversable")
436 dATA_MONOID = mkBaseModule (fsLit "Data.Monoid")
437 gHC_CONC = mkBaseModule (fsLit "GHC.Conc")
438 gHC_IO = mkBaseModule (fsLit "GHC.IO")
439 gHC_IO_Exception = mkBaseModule (fsLit "GHC.IO.Exception")
440 gHC_ST = mkBaseModule (fsLit "GHC.ST")
441 gHC_ARR = mkBaseModule (fsLit "GHC.Arr")
442 gHC_STABLE = mkBaseModule (fsLit "GHC.Stable")
443 gHC_PTR = mkBaseModule (fsLit "GHC.Ptr")
444 gHC_ERR = mkBaseModule (fsLit "GHC.Err")
445 gHC_REAL = mkBaseModule (fsLit "GHC.Real")
446 gHC_FLOAT = mkBaseModule (fsLit "GHC.Float")
447 gHC_TOP_HANDLER = mkBaseModule (fsLit "GHC.TopHandler")
448 sYSTEM_IO = mkBaseModule (fsLit "System.IO")
449 dYNAMIC = mkBaseModule (fsLit "Data.Dynamic")
450 tYPEABLE = mkBaseModule (fsLit "Data.Typeable")
451 tYPEABLE_INTERNAL = mkBaseModule (fsLit "Data.Typeable.Internal")
452 gENERICS = mkBaseModule (fsLit "Data.Data")
453 rEAD_PREC = mkBaseModule (fsLit "Text.ParserCombinators.ReadPrec")
454 lEX = mkBaseModule (fsLit "Text.Read.Lex")
455 gHC_INT = mkBaseModule (fsLit "GHC.Int")
456 gHC_WORD = mkBaseModule (fsLit "GHC.Word")
457 mONAD = mkBaseModule (fsLit "Control.Monad")
458 mONAD_FIX = mkBaseModule (fsLit "Control.Monad.Fix")
459 mONAD_ZIP = mkBaseModule (fsLit "Control.Monad.Zip")
460 mONAD_FAIL = mkBaseModule (fsLit "Control.Monad.Fail")
461 aRROW = mkBaseModule (fsLit "Control.Arrow")
462 cONTROL_APPLICATIVE = mkBaseModule (fsLit "Control.Applicative")
463 gHC_DESUGAR = mkBaseModule (fsLit "GHC.Desugar")
464 rANDOM = mkBaseModule (fsLit "System.Random")
465 gHC_EXTS = mkBaseModule (fsLit "GHC.Exts")
466 cONTROL_EXCEPTION_BASE = mkBaseModule (fsLit "Control.Exception.Base")
467 gHC_GENERICS = mkBaseModule (fsLit "GHC.Generics")
468 gHC_TYPELITS = mkBaseModule (fsLit "GHC.TypeLits")
469
470 gHC_PARR' :: Module
471 gHC_PARR' = mkBaseModule (fsLit "GHC.PArr")
472
473 gHC_SRCLOC :: Module
474 gHC_SRCLOC = mkBaseModule (fsLit "GHC.SrcLoc")
475
476 gHC_STACK, gHC_STACK_TYPES :: Module
477 gHC_STACK = mkBaseModule (fsLit "GHC.Stack")
478 gHC_STACK_TYPES = mkBaseModule (fsLit "GHC.Stack.Types")
479
480 gHC_STATICPTR :: Module
481 gHC_STATICPTR = mkBaseModule (fsLit "GHC.StaticPtr")
482
483 gHC_FINGERPRINT_TYPE :: Module
484 gHC_FINGERPRINT_TYPE = mkBaseModule (fsLit "GHC.Fingerprint.Type")
485
486 gHC_OVER_LABELS :: Module
487 gHC_OVER_LABELS = mkBaseModule (fsLit "GHC.OverloadedLabels")
488
489 mAIN, rOOT_MAIN :: Module
490 mAIN = mkMainModule_ mAIN_NAME
491 rOOT_MAIN = mkMainModule (fsLit ":Main") -- Root module for initialisation
492
493 mkInteractiveModule :: Int -> Module
494 -- (mkInteractiveMoudule 9) makes module 'interactive:M9'
495 mkInteractiveModule n = mkModule interactiveUnitId (mkModuleName ("Ghci" ++ show n))
496
497 pRELUDE_NAME, mAIN_NAME :: ModuleName
498 pRELUDE_NAME = mkModuleNameFS (fsLit "Prelude")
499 mAIN_NAME = mkModuleNameFS (fsLit "Main")
500
501 dATA_ARRAY_PARALLEL_NAME, dATA_ARRAY_PARALLEL_PRIM_NAME :: ModuleName
502 dATA_ARRAY_PARALLEL_NAME = mkModuleNameFS (fsLit "Data.Array.Parallel")
503 dATA_ARRAY_PARALLEL_PRIM_NAME = mkModuleNameFS (fsLit "Data.Array.Parallel.Prim")
504
505 mkPrimModule :: FastString -> Module
506 mkPrimModule m = mkModule primUnitId (mkModuleNameFS m)
507
508 mkIntegerModule :: FastString -> Module
509 mkIntegerModule m = mkModule integerUnitId (mkModuleNameFS m)
510
511 mkBaseModule :: FastString -> Module
512 mkBaseModule m = mkModule baseUnitId (mkModuleNameFS m)
513
514 mkBaseModule_ :: ModuleName -> Module
515 mkBaseModule_ m = mkModule baseUnitId m
516
517 mkThisGhcModule :: FastString -> Module
518 mkThisGhcModule m = mkModule thisGhcUnitId (mkModuleNameFS m)
519
520 mkThisGhcModule_ :: ModuleName -> Module
521 mkThisGhcModule_ m = mkModule thisGhcUnitId m
522
523 mkMainModule :: FastString -> Module
524 mkMainModule m = mkModule mainUnitId (mkModuleNameFS m)
525
526 mkMainModule_ :: ModuleName -> Module
527 mkMainModule_ m = mkModule mainUnitId m
528
529 {-
530 ************************************************************************
531 * *
532 RdrNames
533 * *
534 ************************************************************************
535 -}
536
537 main_RDR_Unqual :: RdrName
538 main_RDR_Unqual = mkUnqual varName (fsLit "main")
539 -- We definitely don't want an Orig RdrName, because
540 -- main might, in principle, be imported into module Main
541
542 forall_tv_RDR, dot_tv_RDR :: RdrName
543 forall_tv_RDR = mkUnqual tvName (fsLit "forall")
544 dot_tv_RDR = mkUnqual tvName (fsLit ".")
545
546 eq_RDR, ge_RDR, ne_RDR, le_RDR, lt_RDR, gt_RDR, compare_RDR,
547 ltTag_RDR, eqTag_RDR, gtTag_RDR :: RdrName
548 eq_RDR = nameRdrName eqName
549 ge_RDR = nameRdrName geName
550 ne_RDR = varQual_RDR gHC_CLASSES (fsLit "/=")
551 le_RDR = varQual_RDR gHC_CLASSES (fsLit "<=")
552 lt_RDR = varQual_RDR gHC_CLASSES (fsLit "<")
553 gt_RDR = varQual_RDR gHC_CLASSES (fsLit ">")
554 compare_RDR = varQual_RDR gHC_CLASSES (fsLit "compare")
555 ltTag_RDR = dataQual_RDR gHC_TYPES (fsLit "LT")
556 eqTag_RDR = dataQual_RDR gHC_TYPES (fsLit "EQ")
557 gtTag_RDR = dataQual_RDR gHC_TYPES (fsLit "GT")
558
559 eqClass_RDR, numClass_RDR, ordClass_RDR, enumClass_RDR, monadClass_RDR
560 :: RdrName
561 eqClass_RDR = nameRdrName eqClassName
562 numClass_RDR = nameRdrName numClassName
563 ordClass_RDR = nameRdrName ordClassName
564 enumClass_RDR = nameRdrName enumClassName
565 monadClass_RDR = nameRdrName monadClassName
566
567 map_RDR, append_RDR :: RdrName
568 map_RDR = varQual_RDR gHC_BASE (fsLit "map")
569 append_RDR = varQual_RDR gHC_BASE (fsLit "++")
570
571 foldr_RDR, build_RDR, returnM_RDR, bindM_RDR, failM_RDR_preMFP, failM_RDR:: RdrName
572 foldr_RDR = nameRdrName foldrName
573 build_RDR = nameRdrName buildName
574 returnM_RDR = nameRdrName returnMName
575 bindM_RDR = nameRdrName bindMName
576 failM_RDR_preMFP = nameRdrName failMName_preMFP
577 failM_RDR = nameRdrName failMName
578
579 left_RDR, right_RDR :: RdrName
580 left_RDR = nameRdrName leftDataConName
581 right_RDR = nameRdrName rightDataConName
582
583 fromEnum_RDR, toEnum_RDR :: RdrName
584 fromEnum_RDR = varQual_RDR gHC_ENUM (fsLit "fromEnum")
585 toEnum_RDR = varQual_RDR gHC_ENUM (fsLit "toEnum")
586
587 enumFrom_RDR, enumFromTo_RDR, enumFromThen_RDR, enumFromThenTo_RDR :: RdrName
588 enumFrom_RDR = nameRdrName enumFromName
589 enumFromTo_RDR = nameRdrName enumFromToName
590 enumFromThen_RDR = nameRdrName enumFromThenName
591 enumFromThenTo_RDR = nameRdrName enumFromThenToName
592
593 ratioDataCon_RDR, plusInteger_RDR, timesInteger_RDR :: RdrName
594 ratioDataCon_RDR = nameRdrName ratioDataConName
595 plusInteger_RDR = nameRdrName plusIntegerName
596 timesInteger_RDR = nameRdrName timesIntegerName
597
598 ioDataCon_RDR :: RdrName
599 ioDataCon_RDR = nameRdrName ioDataConName
600
601 eqString_RDR, unpackCString_RDR, unpackCStringFoldr_RDR,
602 unpackCStringUtf8_RDR :: RdrName
603 eqString_RDR = nameRdrName eqStringName
604 unpackCString_RDR = nameRdrName unpackCStringName
605 unpackCStringFoldr_RDR = nameRdrName unpackCStringFoldrName
606 unpackCStringUtf8_RDR = nameRdrName unpackCStringUtf8Name
607
608 newStablePtr_RDR :: RdrName
609 newStablePtr_RDR = nameRdrName newStablePtrName
610
611 bindIO_RDR, returnIO_RDR :: RdrName
612 bindIO_RDR = nameRdrName bindIOName
613 returnIO_RDR = nameRdrName returnIOName
614
615 fromInteger_RDR, fromRational_RDR, minus_RDR, times_RDR, plus_RDR :: RdrName
616 fromInteger_RDR = nameRdrName fromIntegerName
617 fromRational_RDR = nameRdrName fromRationalName
618 minus_RDR = nameRdrName minusName
619 times_RDR = varQual_RDR gHC_NUM (fsLit "*")
620 plus_RDR = varQual_RDR gHC_NUM (fsLit "+")
621
622 toInteger_RDR, toRational_RDR, fromIntegral_RDR :: RdrName
623 toInteger_RDR = nameRdrName toIntegerName
624 toRational_RDR = nameRdrName toRationalName
625 fromIntegral_RDR = nameRdrName fromIntegralName
626
627 stringTy_RDR, fromString_RDR :: RdrName
628 stringTy_RDR = tcQual_RDR gHC_BASE (fsLit "String")
629 fromString_RDR = nameRdrName fromStringName
630
631 fromList_RDR, fromListN_RDR, toList_RDR :: RdrName
632 fromList_RDR = nameRdrName fromListName
633 fromListN_RDR = nameRdrName fromListNName
634 toList_RDR = nameRdrName toListName
635
636 compose_RDR :: RdrName
637 compose_RDR = varQual_RDR gHC_BASE (fsLit ".")
638
639 not_RDR, getTag_RDR, succ_RDR, pred_RDR, minBound_RDR, maxBound_RDR,
640 and_RDR, range_RDR, inRange_RDR, index_RDR,
641 unsafeIndex_RDR, unsafeRangeSize_RDR :: RdrName
642 and_RDR = varQual_RDR gHC_CLASSES (fsLit "&&")
643 not_RDR = varQual_RDR gHC_CLASSES (fsLit "not")
644 getTag_RDR = varQual_RDR gHC_BASE (fsLit "getTag")
645 succ_RDR = varQual_RDR gHC_ENUM (fsLit "succ")
646 pred_RDR = varQual_RDR gHC_ENUM (fsLit "pred")
647 minBound_RDR = varQual_RDR gHC_ENUM (fsLit "minBound")
648 maxBound_RDR = varQual_RDR gHC_ENUM (fsLit "maxBound")
649 range_RDR = varQual_RDR gHC_ARR (fsLit "range")
650 inRange_RDR = varQual_RDR gHC_ARR (fsLit "inRange")
651 index_RDR = varQual_RDR gHC_ARR (fsLit "index")
652 unsafeIndex_RDR = varQual_RDR gHC_ARR (fsLit "unsafeIndex")
653 unsafeRangeSize_RDR = varQual_RDR gHC_ARR (fsLit "unsafeRangeSize")
654
655 readList_RDR, readListDefault_RDR, readListPrec_RDR, readListPrecDefault_RDR,
656 readPrec_RDR, parens_RDR, choose_RDR, lexP_RDR, expectP_RDR :: RdrName
657 readList_RDR = varQual_RDR gHC_READ (fsLit "readList")
658 readListDefault_RDR = varQual_RDR gHC_READ (fsLit "readListDefault")
659 readListPrec_RDR = varQual_RDR gHC_READ (fsLit "readListPrec")
660 readListPrecDefault_RDR = varQual_RDR gHC_READ (fsLit "readListPrecDefault")
661 readPrec_RDR = varQual_RDR gHC_READ (fsLit "readPrec")
662 parens_RDR = varQual_RDR gHC_READ (fsLit "parens")
663 choose_RDR = varQual_RDR gHC_READ (fsLit "choose")
664 lexP_RDR = varQual_RDR gHC_READ (fsLit "lexP")
665 expectP_RDR = varQual_RDR gHC_READ (fsLit "expectP")
666
667 punc_RDR, ident_RDR, symbol_RDR :: RdrName
668 punc_RDR = dataQual_RDR lEX (fsLit "Punc")
669 ident_RDR = dataQual_RDR lEX (fsLit "Ident")
670 symbol_RDR = dataQual_RDR lEX (fsLit "Symbol")
671
672 step_RDR, alt_RDR, reset_RDR, prec_RDR, pfail_RDR :: RdrName
673 step_RDR = varQual_RDR rEAD_PREC (fsLit "step")
674 alt_RDR = varQual_RDR rEAD_PREC (fsLit "+++")
675 reset_RDR = varQual_RDR rEAD_PREC (fsLit "reset")
676 prec_RDR = varQual_RDR rEAD_PREC (fsLit "prec")
677 pfail_RDR = varQual_RDR rEAD_PREC (fsLit "pfail")
678
679 showList_RDR, showList___RDR, showsPrec_RDR, shows_RDR, showString_RDR,
680 showSpace_RDR, showParen_RDR :: RdrName
681 showList_RDR = varQual_RDR gHC_SHOW (fsLit "showList")
682 showList___RDR = varQual_RDR gHC_SHOW (fsLit "showList__")
683 showsPrec_RDR = varQual_RDR gHC_SHOW (fsLit "showsPrec")
684 shows_RDR = varQual_RDR gHC_SHOW (fsLit "shows")
685 showString_RDR = varQual_RDR gHC_SHOW (fsLit "showString")
686 showSpace_RDR = varQual_RDR gHC_SHOW (fsLit "showSpace")
687 showParen_RDR = varQual_RDR gHC_SHOW (fsLit "showParen")
688
689 undefined_RDR :: RdrName
690 undefined_RDR = varQual_RDR gHC_ERR (fsLit "undefined")
691
692 error_RDR :: RdrName
693 error_RDR = varQual_RDR gHC_ERR (fsLit "error")
694
695 -- Generics (constructors and functions)
696 u1DataCon_RDR, par1DataCon_RDR, rec1DataCon_RDR,
697 k1DataCon_RDR, m1DataCon_RDR, l1DataCon_RDR, r1DataCon_RDR,
698 prodDataCon_RDR, comp1DataCon_RDR,
699 unPar1_RDR, unRec1_RDR, unK1_RDR, unComp1_RDR,
700 from_RDR, from1_RDR, to_RDR, to1_RDR,
701 datatypeName_RDR, moduleName_RDR, packageName_RDR, isNewtypeName_RDR,
702 conName_RDR, conFixity_RDR, conIsRecord_RDR,
703 noArityDataCon_RDR, arityDataCon_RDR, selName_RDR,
704 prefixDataCon_RDR, infixDataCon_RDR, leftAssocDataCon_RDR,
705 rightAssocDataCon_RDR, notAssocDataCon_RDR,
706 uAddrDataCon_RDR, uCharDataCon_RDR, uDoubleDataCon_RDR,
707 uFloatDataCon_RDR, uIntDataCon_RDR, uWordDataCon_RDR,
708 uAddrHash_RDR, uCharHash_RDR, uDoubleHash_RDR,
709 uFloatHash_RDR, uIntHash_RDR, uWordHash_RDR :: RdrName
710
711 u1DataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "U1")
712 par1DataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "Par1")
713 rec1DataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "Rec1")
714 k1DataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "K1")
715 m1DataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "M1")
716
717 l1DataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "L1")
718 r1DataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "R1")
719
720 prodDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit ":*:")
721 comp1DataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "Comp1")
722
723 unPar1_RDR = varQual_RDR gHC_GENERICS (fsLit "unPar1")
724 unRec1_RDR = varQual_RDR gHC_GENERICS (fsLit "unRec1")
725 unK1_RDR = varQual_RDR gHC_GENERICS (fsLit "unK1")
726 unComp1_RDR = varQual_RDR gHC_GENERICS (fsLit "unComp1")
727
728 from_RDR = varQual_RDR gHC_GENERICS (fsLit "from")
729 from1_RDR = varQual_RDR gHC_GENERICS (fsLit "from1")
730 to_RDR = varQual_RDR gHC_GENERICS (fsLit "to")
731 to1_RDR = varQual_RDR gHC_GENERICS (fsLit "to1")
732
733 datatypeName_RDR = varQual_RDR gHC_GENERICS (fsLit "datatypeName")
734 moduleName_RDR = varQual_RDR gHC_GENERICS (fsLit "moduleName")
735 packageName_RDR = varQual_RDR gHC_GENERICS (fsLit "packageName")
736 isNewtypeName_RDR = varQual_RDR gHC_GENERICS (fsLit "isNewtype")
737 selName_RDR = varQual_RDR gHC_GENERICS (fsLit "selName")
738 conName_RDR = varQual_RDR gHC_GENERICS (fsLit "conName")
739 conFixity_RDR = varQual_RDR gHC_GENERICS (fsLit "conFixity")
740 conIsRecord_RDR = varQual_RDR gHC_GENERICS (fsLit "conIsRecord")
741
742 noArityDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NoArity")
743 arityDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "Arity")
744 prefixDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "Prefix")
745 infixDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "Infix")
746 leftAssocDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "LeftAssociative")
747 rightAssocDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "RightAssociative")
748 notAssocDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NotAssociative")
749
750 uAddrDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UAddr")
751 uCharDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UChar")
752 uDoubleDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UDouble")
753 uFloatDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UFloat")
754 uIntDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UInt")
755 uWordDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UWord")
756
757 uAddrHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uAddr#")
758 uCharHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uChar#")
759 uDoubleHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uDouble#")
760 uFloatHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uFloat#")
761 uIntHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uInt#")
762 uWordHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uWord#")
763
764 fmap_RDR, pure_RDR, ap_RDR, foldable_foldr_RDR, foldMap_RDR,
765 traverse_RDR, mempty_RDR, mappend_RDR :: RdrName
766 fmap_RDR = varQual_RDR gHC_BASE (fsLit "fmap")
767 pure_RDR = nameRdrName pureAName
768 ap_RDR = nameRdrName apAName
769 foldable_foldr_RDR = varQual_RDR dATA_FOLDABLE (fsLit "foldr")
770 foldMap_RDR = varQual_RDR dATA_FOLDABLE (fsLit "foldMap")
771 traverse_RDR = varQual_RDR dATA_TRAVERSABLE (fsLit "traverse")
772 mempty_RDR = varQual_RDR gHC_BASE (fsLit "mempty")
773 mappend_RDR = varQual_RDR gHC_BASE (fsLit "mappend")
774
775 ----------------------
776 varQual_RDR, tcQual_RDR, clsQual_RDR, dataQual_RDR
777 :: Module -> FastString -> RdrName
778 varQual_RDR mod str = mkOrig mod (mkOccNameFS varName str)
779 tcQual_RDR mod str = mkOrig mod (mkOccNameFS tcName str)
780 clsQual_RDR mod str = mkOrig mod (mkOccNameFS clsName str)
781 dataQual_RDR mod str = mkOrig mod (mkOccNameFS dataName str)
782
783 {-
784 ************************************************************************
785 * *
786 \subsection{Known-key names}
787 * *
788 ************************************************************************
789
790 Many of these Names are not really "built in", but some parts of the
791 compiler (notably the deriving mechanism) need to mention their names,
792 and it's convenient to write them all down in one place.
793
794 --MetaHaskell Extension add the constrs and the lower case case
795 -- guys as well (perhaps) e.g. see trueDataConName below
796 -}
797
798 -- | Build a 'Name' for the 'Typeable' representation of the given special 'TyCon'.
799 -- Special 'TyCon's include @(->)@, @BOX@, @Constraint@, etc. See 'TysPrim'.
800 mkSpecialTyConRepName :: FastString -> Name -> Name
801 -- See Note [Grand plan for Typeable] in 'TcTypeable' in TcTypeable.
802 mkSpecialTyConRepName fs tc_name
803 = mkExternalName (tyConRepNameUnique (nameUnique tc_name))
804 tYPEABLE_INTERNAL
805 (mkVarOccFS fs)
806 wiredInSrcSpan
807
808 -- | Make a 'Name' for the 'Typeable' representation of the given wired-in type
809 mkPrelTyConRepName :: Name -> Name
810 -- See Note [Grand plan for Typeable] in 'TcTypeable' in TcTypeable.
811 mkPrelTyConRepName tc_name -- Prelude tc_name is always External,
812 -- so nameModule will work
813 = mkExternalName rep_uniq rep_mod rep_occ (nameSrcSpan tc_name)
814 where
815 name_occ = nameOccName tc_name
816 name_mod = nameModule tc_name
817 name_uniq = nameUnique tc_name
818 rep_uniq | isTcOcc name_occ = tyConRepNameUnique name_uniq
819 | otherwise = dataConRepNameUnique name_uniq
820 (rep_mod, rep_occ) = tyConRepModOcc name_mod name_occ
821
822 -- | TODO
823 -- See Note [Grand plan for Typeable] in 'TcTypeable' in TcTypeable.
824 tyConRepModOcc :: Module -> OccName -> (Module, OccName)
825 tyConRepModOcc tc_module tc_occ
826 | tc_module == gHC_TYPES
827 = (tYPEABLE_INTERNAL, mkTyConRepUserOcc tc_occ)
828 | otherwise
829 = (tc_module, mkTyConRepSysOcc tc_occ)
830
831 wildCardName :: Name
832 wildCardName = mkSystemVarName wildCardKey (fsLit "wild")
833
834 runMainIOName :: Name
835 runMainIOName = varQual gHC_TOP_HANDLER (fsLit "runMainIO") runMainKey
836
837 orderingTyConName, ltDataConName, eqDataConName, gtDataConName :: Name
838 orderingTyConName = tcQual gHC_TYPES (fsLit "Ordering") orderingTyConKey
839 ltDataConName = dcQual gHC_TYPES (fsLit "LT") ltDataConKey
840 eqDataConName = dcQual gHC_TYPES (fsLit "EQ") eqDataConKey
841 gtDataConName = dcQual gHC_TYPES (fsLit "GT") gtDataConKey
842
843 specTyConName :: Name
844 specTyConName = tcQual gHC_TYPES (fsLit "SPEC") specTyConKey
845
846 eitherTyConName, leftDataConName, rightDataConName :: Name
847 eitherTyConName = tcQual dATA_EITHER (fsLit "Either") eitherTyConKey
848 leftDataConName = dcQual dATA_EITHER (fsLit "Left") leftDataConKey
849 rightDataConName = dcQual dATA_EITHER (fsLit "Right") rightDataConKey
850
851 -- Generics (types)
852 v1TyConName, u1TyConName, par1TyConName, rec1TyConName,
853 k1TyConName, m1TyConName, sumTyConName, prodTyConName,
854 compTyConName, rTyConName, pTyConName, dTyConName,
855 cTyConName, sTyConName, rec0TyConName, par0TyConName,
856 d1TyConName, c1TyConName, s1TyConName, noSelTyConName,
857 repTyConName, rep1TyConName, uRecTyConName,
858 uAddrTyConName, uCharTyConName, uDoubleTyConName,
859 uFloatTyConName, uIntTyConName, uWordTyConName :: Name
860
861 v1TyConName = tcQual gHC_GENERICS (fsLit "V1") v1TyConKey
862 u1TyConName = tcQual gHC_GENERICS (fsLit "U1") u1TyConKey
863 par1TyConName = tcQual gHC_GENERICS (fsLit "Par1") par1TyConKey
864 rec1TyConName = tcQual gHC_GENERICS (fsLit "Rec1") rec1TyConKey
865 k1TyConName = tcQual gHC_GENERICS (fsLit "K1") k1TyConKey
866 m1TyConName = tcQual gHC_GENERICS (fsLit "M1") m1TyConKey
867
868 sumTyConName = tcQual gHC_GENERICS (fsLit ":+:") sumTyConKey
869 prodTyConName = tcQual gHC_GENERICS (fsLit ":*:") prodTyConKey
870 compTyConName = tcQual gHC_GENERICS (fsLit ":.:") compTyConKey
871
872 rTyConName = tcQual gHC_GENERICS (fsLit "R") rTyConKey
873 pTyConName = tcQual gHC_GENERICS (fsLit "P") pTyConKey
874 dTyConName = tcQual gHC_GENERICS (fsLit "D") dTyConKey
875 cTyConName = tcQual gHC_GENERICS (fsLit "C") cTyConKey
876 sTyConName = tcQual gHC_GENERICS (fsLit "S") sTyConKey
877
878 rec0TyConName = tcQual gHC_GENERICS (fsLit "Rec0") rec0TyConKey
879 par0TyConName = tcQual gHC_GENERICS (fsLit "Par0") par0TyConKey
880 d1TyConName = tcQual gHC_GENERICS (fsLit "D1") d1TyConKey
881 c1TyConName = tcQual gHC_GENERICS (fsLit "C1") c1TyConKey
882 s1TyConName = tcQual gHC_GENERICS (fsLit "S1") s1TyConKey
883 noSelTyConName = tcQual gHC_GENERICS (fsLit "NoSelector") noSelTyConKey
884
885 repTyConName = tcQual gHC_GENERICS (fsLit "Rep") repTyConKey
886 rep1TyConName = tcQual gHC_GENERICS (fsLit "Rep1") rep1TyConKey
887
888 uRecTyConName = tcQual gHC_GENERICS (fsLit "URec") uRecTyConKey
889 uAddrTyConName = tcQual gHC_GENERICS (fsLit "UAddr") uAddrTyConKey
890 uCharTyConName = tcQual gHC_GENERICS (fsLit "UChar") uCharTyConKey
891 uDoubleTyConName = tcQual gHC_GENERICS (fsLit "UDouble") uDoubleTyConKey
892 uFloatTyConName = tcQual gHC_GENERICS (fsLit "UFloat") uFloatTyConKey
893 uIntTyConName = tcQual gHC_GENERICS (fsLit "UInt") uIntTyConKey
894 uWordTyConName = tcQual gHC_GENERICS (fsLit "UWord") uWordTyConKey
895
896 -- Base strings Strings
897 unpackCStringName, unpackCStringFoldrName,
898 unpackCStringUtf8Name, eqStringName :: Name
899 unpackCStringName = varQual gHC_CSTRING (fsLit "unpackCString#") unpackCStringIdKey
900 unpackCStringFoldrName = varQual gHC_CSTRING (fsLit "unpackFoldrCString#") unpackCStringFoldrIdKey
901 unpackCStringUtf8Name = varQual gHC_CSTRING (fsLit "unpackCStringUtf8#") unpackCStringUtf8IdKey
902 eqStringName = varQual gHC_BASE (fsLit "eqString") eqStringIdKey
903
904 -- The 'inline' function
905 inlineIdName :: Name
906 inlineIdName = varQual gHC_MAGIC (fsLit "inline") inlineIdKey
907
908 -- Base classes (Eq, Ord, Functor)
909 fmapName, eqClassName, eqName, ordClassName, geName, functorClassName :: Name
910 eqClassName = clsQual gHC_CLASSES (fsLit "Eq") eqClassKey
911 eqName = varQual gHC_CLASSES (fsLit "==") eqClassOpKey
912 ordClassName = clsQual gHC_CLASSES (fsLit "Ord") ordClassKey
913 geName = varQual gHC_CLASSES (fsLit ">=") geClassOpKey
914 functorClassName = clsQual gHC_BASE (fsLit "Functor") functorClassKey
915 fmapName = varQual gHC_BASE (fsLit "fmap") fmapClassOpKey
916
917 -- Class Monad
918 monadClassName, thenMName, bindMName, returnMName, failMName_preMFP :: Name
919 monadClassName = clsQual gHC_BASE (fsLit "Monad") monadClassKey
920 thenMName = varQual gHC_BASE (fsLit ">>") thenMClassOpKey
921 bindMName = varQual gHC_BASE (fsLit ">>=") bindMClassOpKey
922 returnMName = varQual gHC_BASE (fsLit "return") returnMClassOpKey
923 failMName_preMFP = varQual gHC_BASE (fsLit "fail") failMClassOpKey_preMFP
924
925 -- Class MonadFail
926 monadFailClassName, failMName :: Name
927 monadFailClassName = clsQual mONAD_FAIL (fsLit "MonadFail") monadFailClassKey
928 failMName = varQual mONAD_FAIL (fsLit "fail") failMClassOpKey
929
930 -- Classes (Applicative, Foldable, Traversable)
931 applicativeClassName, foldableClassName, traversableClassName :: Name
932 applicativeClassName = clsQual gHC_BASE (fsLit "Applicative") applicativeClassKey
933 foldableClassName = clsQual dATA_FOLDABLE (fsLit "Foldable") foldableClassKey
934 traversableClassName = clsQual dATA_TRAVERSABLE (fsLit "Traversable") traversableClassKey
935
936
937
938 -- AMP additions
939
940 joinMName, apAName, pureAName, alternativeClassName :: Name
941 joinMName = varQual gHC_BASE (fsLit "join") joinMIdKey
942 apAName = varQual gHC_BASE (fsLit "<*>") apAClassOpKey
943 pureAName = varQual gHC_BASE (fsLit "pure") pureAClassOpKey
944 alternativeClassName = clsQual mONAD (fsLit "Alternative") alternativeClassKey
945
946 joinMIdKey, apAClassOpKey, pureAClassOpKey, alternativeClassKey :: Unique
947 joinMIdKey = mkPreludeMiscIdUnique 750
948 apAClassOpKey = mkPreludeMiscIdUnique 751 -- <*>
949 pureAClassOpKey = mkPreludeMiscIdUnique 752
950 alternativeClassKey = mkPreludeMiscIdUnique 753
951
952
953 -- Functions for GHC extensions
954 groupWithName :: Name
955 groupWithName = varQual gHC_EXTS (fsLit "groupWith") groupWithIdKey
956
957 -- Random PrelBase functions
958 fromStringName, otherwiseIdName, foldrName, buildName, augmentName,
959 mapName, appendName, assertName,
960 breakpointName, breakpointCondName, breakpointAutoName,
961 opaqueTyConName :: Name
962 fromStringName = varQual dATA_STRING (fsLit "fromString") fromStringClassOpKey
963 otherwiseIdName = varQual gHC_BASE (fsLit "otherwise") otherwiseIdKey
964 foldrName = varQual gHC_BASE (fsLit "foldr") foldrIdKey
965 buildName = varQual gHC_BASE (fsLit "build") buildIdKey
966 augmentName = varQual gHC_BASE (fsLit "augment") augmentIdKey
967 mapName = varQual gHC_BASE (fsLit "map") mapIdKey
968 appendName = varQual gHC_BASE (fsLit "++") appendIdKey
969 assertName = varQual gHC_BASE (fsLit "assert") assertIdKey
970 breakpointName = varQual gHC_BASE (fsLit "breakpoint") breakpointIdKey
971 breakpointCondName= varQual gHC_BASE (fsLit "breakpointCond") breakpointCondIdKey
972 breakpointAutoName= varQual gHC_BASE (fsLit "breakpointAuto") breakpointAutoIdKey
973 opaqueTyConName = tcQual gHC_BASE (fsLit "Opaque") opaqueTyConKey
974
975 breakpointJumpName :: Name
976 breakpointJumpName
977 = mkInternalName
978 breakpointJumpIdKey
979 (mkOccNameFS varName (fsLit "breakpointJump"))
980 noSrcSpan
981 breakpointCondJumpName :: Name
982 breakpointCondJumpName
983 = mkInternalName
984 breakpointCondJumpIdKey
985 (mkOccNameFS varName (fsLit "breakpointCondJump"))
986 noSrcSpan
987 breakpointAutoJumpName :: Name
988 breakpointAutoJumpName
989 = mkInternalName
990 breakpointAutoJumpIdKey
991 (mkOccNameFS varName (fsLit "breakpointAutoJump"))
992 noSrcSpan
993
994 -- PrelTup
995 fstName, sndName :: Name
996 fstName = varQual dATA_TUPLE (fsLit "fst") fstIdKey
997 sndName = varQual dATA_TUPLE (fsLit "snd") sndIdKey
998
999 -- Module GHC.Num
1000 numClassName, fromIntegerName, minusName, negateName :: Name
1001 numClassName = clsQual gHC_NUM (fsLit "Num") numClassKey
1002 fromIntegerName = varQual gHC_NUM (fsLit "fromInteger") fromIntegerClassOpKey
1003 minusName = varQual gHC_NUM (fsLit "-") minusClassOpKey
1004 negateName = varQual gHC_NUM (fsLit "negate") negateClassOpKey
1005
1006 integerTyConName, mkIntegerName, integerSDataConName,
1007 integerToWord64Name, integerToInt64Name,
1008 word64ToIntegerName, int64ToIntegerName,
1009 plusIntegerName, timesIntegerName, smallIntegerName,
1010 wordToIntegerName,
1011 integerToWordName, integerToIntName, minusIntegerName,
1012 negateIntegerName, eqIntegerPrimName, neqIntegerPrimName,
1013 absIntegerName, signumIntegerName,
1014 leIntegerPrimName, gtIntegerPrimName, ltIntegerPrimName, geIntegerPrimName,
1015 compareIntegerName, quotRemIntegerName, divModIntegerName,
1016 quotIntegerName, remIntegerName, divIntegerName, modIntegerName,
1017 floatFromIntegerName, doubleFromIntegerName,
1018 encodeFloatIntegerName, encodeDoubleIntegerName,
1019 decodeDoubleIntegerName,
1020 gcdIntegerName, lcmIntegerName,
1021 andIntegerName, orIntegerName, xorIntegerName, complementIntegerName,
1022 shiftLIntegerName, shiftRIntegerName, bitIntegerName :: Name
1023 integerTyConName = tcQual gHC_INTEGER_TYPE (fsLit "Integer") integerTyConKey
1024 integerSDataConName = dcQual gHC_INTEGER_TYPE (fsLit n) integerSDataConKey
1025 where n = case cIntegerLibraryType of
1026 IntegerGMP -> "S#"
1027 IntegerSimple -> panic "integerSDataConName evaluated for integer-simple"
1028 mkIntegerName = varQual gHC_INTEGER_TYPE (fsLit "mkInteger") mkIntegerIdKey
1029 integerToWord64Name = varQual gHC_INTEGER_TYPE (fsLit "integerToWord64") integerToWord64IdKey
1030 integerToInt64Name = varQual gHC_INTEGER_TYPE (fsLit "integerToInt64") integerToInt64IdKey
1031 word64ToIntegerName = varQual gHC_INTEGER_TYPE (fsLit "word64ToInteger") word64ToIntegerIdKey
1032 int64ToIntegerName = varQual gHC_INTEGER_TYPE (fsLit "int64ToInteger") int64ToIntegerIdKey
1033 plusIntegerName = varQual gHC_INTEGER_TYPE (fsLit "plusInteger") plusIntegerIdKey
1034 timesIntegerName = varQual gHC_INTEGER_TYPE (fsLit "timesInteger") timesIntegerIdKey
1035 smallIntegerName = varQual gHC_INTEGER_TYPE (fsLit "smallInteger") smallIntegerIdKey
1036 wordToIntegerName = varQual gHC_INTEGER_TYPE (fsLit "wordToInteger") wordToIntegerIdKey
1037 integerToWordName = varQual gHC_INTEGER_TYPE (fsLit "integerToWord") integerToWordIdKey
1038 integerToIntName = varQual gHC_INTEGER_TYPE (fsLit "integerToInt") integerToIntIdKey
1039 minusIntegerName = varQual gHC_INTEGER_TYPE (fsLit "minusInteger") minusIntegerIdKey
1040 negateIntegerName = varQual gHC_INTEGER_TYPE (fsLit "negateInteger") negateIntegerIdKey
1041 eqIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "eqInteger#") eqIntegerPrimIdKey
1042 neqIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "neqInteger#") neqIntegerPrimIdKey
1043 absIntegerName = varQual gHC_INTEGER_TYPE (fsLit "absInteger") absIntegerIdKey
1044 signumIntegerName = varQual gHC_INTEGER_TYPE (fsLit "signumInteger") signumIntegerIdKey
1045 leIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "leInteger#") leIntegerPrimIdKey
1046 gtIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "gtInteger#") gtIntegerPrimIdKey
1047 ltIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "ltInteger#") ltIntegerPrimIdKey
1048 geIntegerPrimName = varQual gHC_INTEGER_TYPE (fsLit "geInteger#") geIntegerPrimIdKey
1049 compareIntegerName = varQual gHC_INTEGER_TYPE (fsLit "compareInteger") compareIntegerIdKey
1050 quotRemIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger") quotRemIntegerIdKey
1051 divModIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divModInteger") divModIntegerIdKey
1052 quotIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotInteger") quotIntegerIdKey
1053 remIntegerName = varQual gHC_INTEGER_TYPE (fsLit "remInteger") remIntegerIdKey
1054 divIntegerName = varQual gHC_INTEGER_TYPE (fsLit "divInteger") divIntegerIdKey
1055 modIntegerName = varQual gHC_INTEGER_TYPE (fsLit "modInteger") modIntegerIdKey
1056 floatFromIntegerName = varQual gHC_INTEGER_TYPE (fsLit "floatFromInteger") floatFromIntegerIdKey
1057 doubleFromIntegerName = varQual gHC_INTEGER_TYPE (fsLit "doubleFromInteger") doubleFromIntegerIdKey
1058 encodeFloatIntegerName = varQual gHC_INTEGER_TYPE (fsLit "encodeFloatInteger") encodeFloatIntegerIdKey
1059 encodeDoubleIntegerName = varQual gHC_INTEGER_TYPE (fsLit "encodeDoubleInteger") encodeDoubleIntegerIdKey
1060 decodeDoubleIntegerName = varQual gHC_INTEGER_TYPE (fsLit "decodeDoubleInteger") decodeDoubleIntegerIdKey
1061 gcdIntegerName = varQual gHC_INTEGER_TYPE (fsLit "gcdInteger") gcdIntegerIdKey
1062 lcmIntegerName = varQual gHC_INTEGER_TYPE (fsLit "lcmInteger") lcmIntegerIdKey
1063 andIntegerName = varQual gHC_INTEGER_TYPE (fsLit "andInteger") andIntegerIdKey
1064 orIntegerName = varQual gHC_INTEGER_TYPE (fsLit "orInteger") orIntegerIdKey
1065 xorIntegerName = varQual gHC_INTEGER_TYPE (fsLit "xorInteger") xorIntegerIdKey
1066 complementIntegerName = varQual gHC_INTEGER_TYPE (fsLit "complementInteger") complementIntegerIdKey
1067 shiftLIntegerName = varQual gHC_INTEGER_TYPE (fsLit "shiftLInteger") shiftLIntegerIdKey
1068 shiftRIntegerName = varQual gHC_INTEGER_TYPE (fsLit "shiftRInteger") shiftRIntegerIdKey
1069 bitIntegerName = varQual gHC_INTEGER_TYPE (fsLit "bitInteger") bitIntegerIdKey
1070
1071 -- GHC.Real types and classes
1072 rationalTyConName, ratioTyConName, ratioDataConName, realClassName,
1073 integralClassName, realFracClassName, fractionalClassName,
1074 fromRationalName, toIntegerName, toRationalName, fromIntegralName,
1075 realToFracName :: Name
1076 rationalTyConName = tcQual gHC_REAL (fsLit "Rational") rationalTyConKey
1077 ratioTyConName = tcQual gHC_REAL (fsLit "Ratio") ratioTyConKey
1078 ratioDataConName = dcQual gHC_REAL (fsLit ":%") ratioDataConKey
1079 realClassName = clsQual gHC_REAL (fsLit "Real") realClassKey
1080 integralClassName = clsQual gHC_REAL (fsLit "Integral") integralClassKey
1081 realFracClassName = clsQual gHC_REAL (fsLit "RealFrac") realFracClassKey
1082 fractionalClassName = clsQual gHC_REAL (fsLit "Fractional") fractionalClassKey
1083 fromRationalName = varQual gHC_REAL (fsLit "fromRational") fromRationalClassOpKey
1084 toIntegerName = varQual gHC_REAL (fsLit "toInteger") toIntegerClassOpKey
1085 toRationalName = varQual gHC_REAL (fsLit "toRational") toRationalClassOpKey
1086 fromIntegralName = varQual gHC_REAL (fsLit "fromIntegral")fromIntegralIdKey
1087 realToFracName = varQual gHC_REAL (fsLit "realToFrac") realToFracIdKey
1088
1089 -- PrelFloat classes
1090 floatingClassName, realFloatClassName :: Name
1091 floatingClassName = clsQual gHC_FLOAT (fsLit "Floating") floatingClassKey
1092 realFloatClassName = clsQual gHC_FLOAT (fsLit "RealFloat") realFloatClassKey
1093
1094 -- other GHC.Float functions
1095 rationalToFloatName, rationalToDoubleName :: Name
1096 rationalToFloatName = varQual gHC_FLOAT (fsLit "rationalToFloat") rationalToFloatIdKey
1097 rationalToDoubleName = varQual gHC_FLOAT (fsLit "rationalToDouble") rationalToDoubleIdKey
1098
1099 -- Class Ix
1100 ixClassName :: Name
1101 ixClassName = clsQual gHC_ARR (fsLit "Ix") ixClassKey
1102
1103 -- Class Typeable, and functions for constructing `Typeable` dictionaries
1104 typeableClassName
1105 , typeRepTyConName
1106 , trTyConDataConName
1107 , trModuleDataConName
1108 , trNameSDataConName
1109 , mkPolyTyConAppName
1110 , mkAppTyName
1111 , typeRepIdName
1112 , typeNatTypeRepName
1113 , typeSymbolTypeRepName
1114 :: Name
1115 typeableClassName = clsQual tYPEABLE_INTERNAL (fsLit "Typeable") typeableClassKey
1116 typeRepTyConName = tcQual tYPEABLE_INTERNAL (fsLit "TypeRep") typeRepTyConKey
1117 trTyConDataConName = dcQual gHC_TYPES (fsLit "TyCon") trTyConDataConKey
1118 trModuleDataConName = dcQual gHC_TYPES (fsLit "Module") trModuleDataConKey
1119 trNameSDataConName = dcQual gHC_TYPES (fsLit "TrNameS") trNameSDataConKey
1120 typeRepIdName = varQual tYPEABLE_INTERNAL (fsLit "typeRep#") typeRepIdKey
1121 mkPolyTyConAppName = varQual tYPEABLE_INTERNAL (fsLit "mkPolyTyConApp") mkPolyTyConAppKey
1122 mkAppTyName = varQual tYPEABLE_INTERNAL (fsLit "mkAppTy") mkAppTyKey
1123 typeNatTypeRepName = varQual tYPEABLE_INTERNAL (fsLit "typeNatTypeRep") typeNatTypeRepKey
1124 typeSymbolTypeRepName = varQual tYPEABLE_INTERNAL (fsLit "typeSymbolTypeRep") typeSymbolTypeRepKey
1125
1126 -- Custom type errors
1127 errorMessageTypeErrorFamName
1128 , typeErrorTextDataConName
1129 , typeErrorAppendDataConName
1130 , typeErrorVAppendDataConName
1131 , typeErrorShowTypeDataConName
1132 :: Name
1133
1134 errorMessageTypeErrorFamName =
1135 tcQual gHC_TYPELITS (fsLit "TypeError") errorMessageTypeErrorFamKey
1136
1137 typeErrorTextDataConName =
1138 dcQual gHC_TYPELITS (fsLit "Text") typeErrorTextDataConKey
1139
1140 typeErrorAppendDataConName =
1141 dcQual gHC_TYPELITS (fsLit ":<>:") typeErrorAppendDataConKey
1142
1143 typeErrorVAppendDataConName =
1144 dcQual gHC_TYPELITS (fsLit ":$$:") typeErrorVAppendDataConKey
1145
1146 typeErrorShowTypeDataConName =
1147 dcQual gHC_TYPELITS (fsLit "ShowType") typeErrorShowTypeDataConKey
1148
1149
1150
1151 -- Dynamic
1152 toDynName :: Name
1153 toDynName = varQual dYNAMIC (fsLit "toDyn") toDynIdKey
1154
1155 -- Class Data
1156 dataClassName :: Name
1157 dataClassName = clsQual gENERICS (fsLit "Data") dataClassKey
1158
1159 -- Error module
1160 assertErrorName :: Name
1161 assertErrorName = varQual gHC_IO_Exception (fsLit "assertError") assertErrorIdKey
1162
1163 -- Enum module (Enum, Bounded)
1164 enumClassName, enumFromName, enumFromToName, enumFromThenName,
1165 enumFromThenToName, boundedClassName :: Name
1166 enumClassName = clsQual gHC_ENUM (fsLit "Enum") enumClassKey
1167 enumFromName = varQual gHC_ENUM (fsLit "enumFrom") enumFromClassOpKey
1168 enumFromToName = varQual gHC_ENUM (fsLit "enumFromTo") enumFromToClassOpKey
1169 enumFromThenName = varQual gHC_ENUM (fsLit "enumFromThen") enumFromThenClassOpKey
1170 enumFromThenToName = varQual gHC_ENUM (fsLit "enumFromThenTo") enumFromThenToClassOpKey
1171 boundedClassName = clsQual gHC_ENUM (fsLit "Bounded") boundedClassKey
1172
1173 -- List functions
1174 concatName, filterName, zipName :: Name
1175 concatName = varQual gHC_LIST (fsLit "concat") concatIdKey
1176 filterName = varQual gHC_LIST (fsLit "filter") filterIdKey
1177 zipName = varQual gHC_LIST (fsLit "zip") zipIdKey
1178
1179 -- Overloaded lists
1180 isListClassName, fromListName, fromListNName, toListName :: Name
1181 isListClassName = clsQual gHC_EXTS (fsLit "IsList") isListClassKey
1182 fromListName = varQual gHC_EXTS (fsLit "fromList") fromListClassOpKey
1183 fromListNName = varQual gHC_EXTS (fsLit "fromListN") fromListNClassOpKey
1184 toListName = varQual gHC_EXTS (fsLit "toList") toListClassOpKey
1185
1186 -- Class Show
1187 showClassName :: Name
1188 showClassName = clsQual gHC_SHOW (fsLit "Show") showClassKey
1189
1190 -- Class Read
1191 readClassName :: Name
1192 readClassName = clsQual gHC_READ (fsLit "Read") readClassKey
1193
1194 -- Classes Generic and Generic1, Datatype, Constructor and Selector
1195 genClassName, gen1ClassName, datatypeClassName, constructorClassName,
1196 selectorClassName :: Name
1197 genClassName = clsQual gHC_GENERICS (fsLit "Generic") genClassKey
1198 gen1ClassName = clsQual gHC_GENERICS (fsLit "Generic1") gen1ClassKey
1199
1200 datatypeClassName = clsQual gHC_GENERICS (fsLit "Datatype") datatypeClassKey
1201 constructorClassName = clsQual gHC_GENERICS (fsLit "Constructor") constructorClassKey
1202 selectorClassName = clsQual gHC_GENERICS (fsLit "Selector") selectorClassKey
1203
1204 genericClassNames :: [Name]
1205 genericClassNames = [genClassName, gen1ClassName]
1206
1207 -- GHCi things
1208 ghciIoClassName, ghciStepIoMName :: Name
1209 ghciIoClassName = clsQual gHC_GHCI (fsLit "GHCiSandboxIO") ghciIoClassKey
1210 ghciStepIoMName = varQual gHC_GHCI (fsLit "ghciStepIO") ghciStepIoMClassOpKey
1211
1212 -- IO things
1213 ioTyConName, ioDataConName,
1214 thenIOName, bindIOName, returnIOName, failIOName :: Name
1215 ioTyConName = tcQual gHC_TYPES (fsLit "IO") ioTyConKey
1216 ioDataConName = dcQual gHC_TYPES (fsLit "IO") ioDataConKey
1217 thenIOName = varQual gHC_BASE (fsLit "thenIO") thenIOIdKey
1218 bindIOName = varQual gHC_BASE (fsLit "bindIO") bindIOIdKey
1219 returnIOName = varQual gHC_BASE (fsLit "returnIO") returnIOIdKey
1220 failIOName = varQual gHC_IO (fsLit "failIO") failIOIdKey
1221
1222 -- IO things
1223 printName :: Name
1224 printName = varQual sYSTEM_IO (fsLit "print") printIdKey
1225
1226 -- Int, Word, and Addr things
1227 int8TyConName, int16TyConName, int32TyConName, int64TyConName :: Name
1228 int8TyConName = tcQual gHC_INT (fsLit "Int8") int8TyConKey
1229 int16TyConName = tcQual gHC_INT (fsLit "Int16") int16TyConKey
1230 int32TyConName = tcQual gHC_INT (fsLit "Int32") int32TyConKey
1231 int64TyConName = tcQual gHC_INT (fsLit "Int64") int64TyConKey
1232
1233 -- Word module
1234 word16TyConName, word32TyConName, word64TyConName :: Name
1235 word16TyConName = tcQual gHC_WORD (fsLit "Word16") word16TyConKey
1236 word32TyConName = tcQual gHC_WORD (fsLit "Word32") word32TyConKey
1237 word64TyConName = tcQual gHC_WORD (fsLit "Word64") word64TyConKey
1238
1239 -- PrelPtr module
1240 ptrTyConName, funPtrTyConName :: Name
1241 ptrTyConName = tcQual gHC_PTR (fsLit "Ptr") ptrTyConKey
1242 funPtrTyConName = tcQual gHC_PTR (fsLit "FunPtr") funPtrTyConKey
1243
1244 -- Foreign objects and weak pointers
1245 stablePtrTyConName, newStablePtrName :: Name
1246 stablePtrTyConName = tcQual gHC_STABLE (fsLit "StablePtr") stablePtrTyConKey
1247 newStablePtrName = varQual gHC_STABLE (fsLit "newStablePtr") newStablePtrIdKey
1248
1249 -- Recursive-do notation
1250 monadFixClassName, mfixName :: Name
1251 monadFixClassName = clsQual mONAD_FIX (fsLit "MonadFix") monadFixClassKey
1252 mfixName = varQual mONAD_FIX (fsLit "mfix") mfixIdKey
1253
1254 -- Arrow notation
1255 arrAName, composeAName, firstAName, appAName, choiceAName, loopAName :: Name
1256 arrAName = varQual aRROW (fsLit "arr") arrAIdKey
1257 composeAName = varQual gHC_DESUGAR (fsLit ">>>") composeAIdKey
1258 firstAName = varQual aRROW (fsLit "first") firstAIdKey
1259 appAName = varQual aRROW (fsLit "app") appAIdKey
1260 choiceAName = varQual aRROW (fsLit "|||") choiceAIdKey
1261 loopAName = varQual aRROW (fsLit "loop") loopAIdKey
1262
1263 -- Monad comprehensions
1264 guardMName, liftMName, mzipName :: Name
1265 guardMName = varQual mONAD (fsLit "guard") guardMIdKey
1266 liftMName = varQual mONAD (fsLit "liftM") liftMIdKey
1267 mzipName = varQual mONAD_ZIP (fsLit "mzip") mzipIdKey
1268
1269
1270 -- Annotation type checking
1271 toAnnotationWrapperName :: Name
1272 toAnnotationWrapperName = varQual gHC_DESUGAR (fsLit "toAnnotationWrapper") toAnnotationWrapperIdKey
1273
1274 -- Other classes, needed for type defaulting
1275 monadPlusClassName, randomClassName, randomGenClassName,
1276 isStringClassName :: Name
1277 monadPlusClassName = clsQual mONAD (fsLit "MonadPlus") monadPlusClassKey
1278 randomClassName = clsQual rANDOM (fsLit "Random") randomClassKey
1279 randomGenClassName = clsQual rANDOM (fsLit "RandomGen") randomGenClassKey
1280 isStringClassName = clsQual dATA_STRING (fsLit "IsString") isStringClassKey
1281
1282 -- Type-level naturals
1283 knownNatClassName :: Name
1284 knownNatClassName = clsQual gHC_TYPELITS (fsLit "KnownNat") knownNatClassNameKey
1285 knownSymbolClassName :: Name
1286 knownSymbolClassName = clsQual gHC_TYPELITS (fsLit "KnownSymbol") knownSymbolClassNameKey
1287
1288 -- Overloaded labels
1289 isLabelClassName :: Name
1290 isLabelClassName
1291 = clsQual gHC_OVER_LABELS (fsLit "IsLabel") isLabelClassNameKey
1292
1293 -- Source Locations
1294 callStackDataConName, callStackTyConName, srcLocDataConName :: Name
1295 callStackDataConName
1296 = dcQual gHC_STACK_TYPES (fsLit "CallStack") callStackDataConKey
1297 callStackTyConName
1298 = tcQual gHC_STACK_TYPES (fsLit "CallStack") callStackTyConKey
1299 srcLocDataConName
1300 = dcQual gHC_STACK_TYPES (fsLit "SrcLoc") srcLocDataConKey
1301
1302 -- plugins
1303 pLUGINS :: Module
1304 pLUGINS = mkThisGhcModule (fsLit "Plugins")
1305 pluginTyConName :: Name
1306 pluginTyConName = tcQual pLUGINS (fsLit "Plugin") pluginTyConKey
1307
1308 -- Static pointers
1309 staticPtrInfoTyConName :: Name
1310 staticPtrInfoTyConName =
1311 tcQual gHC_STATICPTR (fsLit "StaticPtrInfo") staticPtrInfoTyConKey
1312
1313 staticPtrInfoDataConName :: Name
1314 staticPtrInfoDataConName =
1315 dcQual gHC_STATICPTR (fsLit "StaticPtrInfo") staticPtrInfoDataConKey
1316
1317 staticPtrTyConName :: Name
1318 staticPtrTyConName =
1319 tcQual gHC_STATICPTR (fsLit "StaticPtr") staticPtrTyConKey
1320
1321 staticPtrDataConName :: Name
1322 staticPtrDataConName =
1323 dcQual gHC_STATICPTR (fsLit "StaticPtr") staticPtrDataConKey
1324
1325 fingerprintDataConName :: Name
1326 fingerprintDataConName =
1327 dcQual gHC_FINGERPRINT_TYPE (fsLit "Fingerprint") fingerprintDataConKey
1328
1329 {-
1330 ************************************************************************
1331 * *
1332 \subsection{Local helpers}
1333 * *
1334 ************************************************************************
1335
1336 All these are original names; hence mkOrig
1337 -}
1338
1339 varQual, tcQual, clsQual, dcQual :: Module -> FastString -> Unique -> Name
1340 varQual = mk_known_key_name varName
1341 tcQual = mk_known_key_name tcName
1342 clsQual = mk_known_key_name clsName
1343 dcQual = mk_known_key_name dataName
1344
1345 mk_known_key_name :: NameSpace -> Module -> FastString -> Unique -> Name
1346 mk_known_key_name space modu str unique
1347 = mkExternalName unique modu (mkOccNameFS space str) noSrcSpan
1348
1349
1350 {-
1351 ************************************************************************
1352 * *
1353 \subsubsection[Uniques-prelude-Classes]{@Uniques@ for wired-in @Classes@}
1354 * *
1355 ************************************************************************
1356 --MetaHaskell extension hand allocate keys here
1357 -}
1358
1359 boundedClassKey, enumClassKey, eqClassKey, floatingClassKey,
1360 fractionalClassKey, integralClassKey, monadClassKey, dataClassKey,
1361 functorClassKey, numClassKey, ordClassKey, readClassKey, realClassKey,
1362 realFloatClassKey, realFracClassKey, showClassKey, ixClassKey :: Unique
1363 boundedClassKey = mkPreludeClassUnique 1
1364 enumClassKey = mkPreludeClassUnique 2
1365 eqClassKey = mkPreludeClassUnique 3
1366 floatingClassKey = mkPreludeClassUnique 5
1367 fractionalClassKey = mkPreludeClassUnique 6
1368 integralClassKey = mkPreludeClassUnique 7
1369 monadClassKey = mkPreludeClassUnique 8
1370 dataClassKey = mkPreludeClassUnique 9
1371 functorClassKey = mkPreludeClassUnique 10
1372 numClassKey = mkPreludeClassUnique 11
1373 ordClassKey = mkPreludeClassUnique 12
1374 readClassKey = mkPreludeClassUnique 13
1375 realClassKey = mkPreludeClassUnique 14
1376 realFloatClassKey = mkPreludeClassUnique 15
1377 realFracClassKey = mkPreludeClassUnique 16
1378 showClassKey = mkPreludeClassUnique 17
1379 ixClassKey = mkPreludeClassUnique 18
1380
1381 typeableClassKey, typeable1ClassKey, typeable2ClassKey, typeable3ClassKey,
1382 typeable4ClassKey, typeable5ClassKey, typeable6ClassKey, typeable7ClassKey
1383 :: Unique
1384 typeableClassKey = mkPreludeClassUnique 20
1385 typeable1ClassKey = mkPreludeClassUnique 21
1386 typeable2ClassKey = mkPreludeClassUnique 22
1387 typeable3ClassKey = mkPreludeClassUnique 23
1388 typeable4ClassKey = mkPreludeClassUnique 24
1389 typeable5ClassKey = mkPreludeClassUnique 25
1390 typeable6ClassKey = mkPreludeClassUnique 26
1391 typeable7ClassKey = mkPreludeClassUnique 27
1392
1393 monadFixClassKey :: Unique
1394 monadFixClassKey = mkPreludeClassUnique 28
1395
1396 monadFailClassKey :: Unique
1397 monadFailClassKey = mkPreludeClassUnique 29
1398
1399 monadPlusClassKey, randomClassKey, randomGenClassKey :: Unique
1400 monadPlusClassKey = mkPreludeClassUnique 30
1401 randomClassKey = mkPreludeClassUnique 31
1402 randomGenClassKey = mkPreludeClassUnique 32
1403
1404 isStringClassKey :: Unique
1405 isStringClassKey = mkPreludeClassUnique 33
1406
1407 applicativeClassKey, foldableClassKey, traversableClassKey :: Unique
1408 applicativeClassKey = mkPreludeClassUnique 34
1409 foldableClassKey = mkPreludeClassUnique 35
1410 traversableClassKey = mkPreludeClassUnique 36
1411
1412 genClassKey, gen1ClassKey, datatypeClassKey, constructorClassKey,
1413 selectorClassKey :: Unique
1414 genClassKey = mkPreludeClassUnique 37
1415 gen1ClassKey = mkPreludeClassUnique 38
1416
1417 datatypeClassKey = mkPreludeClassUnique 39
1418 constructorClassKey = mkPreludeClassUnique 40
1419 selectorClassKey = mkPreludeClassUnique 41
1420
1421 -- KnownNat: see Note [KnowNat & KnownSymbol and EvLit] in TcEvidence
1422 knownNatClassNameKey :: Unique
1423 knownNatClassNameKey = mkPreludeClassUnique 42
1424
1425 -- KnownSymbol: see Note [KnownNat & KnownSymbol and EvLit] in TcEvidence
1426 knownSymbolClassNameKey :: Unique
1427 knownSymbolClassNameKey = mkPreludeClassUnique 43
1428
1429 ghciIoClassKey :: Unique
1430 ghciIoClassKey = mkPreludeClassUnique 44
1431
1432 isLabelClassNameKey :: Unique
1433 isLabelClassNameKey = mkPreludeClassUnique 45
1434
1435 ---------------- Template Haskell -------------------
1436 -- THNames.hs: USES ClassUniques 200-299
1437 -----------------------------------------------------
1438
1439 {-
1440 ************************************************************************
1441 * *
1442 \subsubsection[Uniques-prelude-TyCons]{@Uniques@ for wired-in @TyCons@}
1443 * *
1444 ************************************************************************
1445 -}
1446
1447 addrPrimTyConKey, arrayPrimTyConKey, arrayArrayPrimTyConKey, boolTyConKey,
1448 byteArrayPrimTyConKey, charPrimTyConKey, charTyConKey, doublePrimTyConKey,
1449 doubleTyConKey, floatPrimTyConKey, floatTyConKey, funTyConKey,
1450 intPrimTyConKey, intTyConKey, int8TyConKey, int16TyConKey,
1451 int32PrimTyConKey, int32TyConKey, int64PrimTyConKey, int64TyConKey,
1452 integerTyConKey, listTyConKey, foreignObjPrimTyConKey, maybeTyConKey,
1453 weakPrimTyConKey, mutableArrayPrimTyConKey, mutableArrayArrayPrimTyConKey,
1454 mutableByteArrayPrimTyConKey, orderingTyConKey, mVarPrimTyConKey,
1455 ratioTyConKey, rationalTyConKey, realWorldTyConKey, stablePtrPrimTyConKey,
1456 stablePtrTyConKey, anyTyConKey, eqTyConKey, smallArrayPrimTyConKey,
1457 smallMutableArrayPrimTyConKey :: Unique
1458 addrPrimTyConKey = mkPreludeTyConUnique 1
1459 arrayPrimTyConKey = mkPreludeTyConUnique 3
1460 boolTyConKey = mkPreludeTyConUnique 4
1461 byteArrayPrimTyConKey = mkPreludeTyConUnique 5
1462 charPrimTyConKey = mkPreludeTyConUnique 7
1463 charTyConKey = mkPreludeTyConUnique 8
1464 doublePrimTyConKey = mkPreludeTyConUnique 9
1465 doubleTyConKey = mkPreludeTyConUnique 10
1466 floatPrimTyConKey = mkPreludeTyConUnique 11
1467 floatTyConKey = mkPreludeTyConUnique 12
1468 funTyConKey = mkPreludeTyConUnique 13
1469 intPrimTyConKey = mkPreludeTyConUnique 14
1470 intTyConKey = mkPreludeTyConUnique 15
1471 int8TyConKey = mkPreludeTyConUnique 16
1472 int16TyConKey = mkPreludeTyConUnique 17
1473 int32PrimTyConKey = mkPreludeTyConUnique 18
1474 int32TyConKey = mkPreludeTyConUnique 19
1475 int64PrimTyConKey = mkPreludeTyConUnique 20
1476 int64TyConKey = mkPreludeTyConUnique 21
1477 integerTyConKey = mkPreludeTyConUnique 22
1478
1479 listTyConKey = mkPreludeTyConUnique 24
1480 foreignObjPrimTyConKey = mkPreludeTyConUnique 25
1481 maybeTyConKey = mkPreludeTyConUnique 26
1482 weakPrimTyConKey = mkPreludeTyConUnique 27
1483 mutableArrayPrimTyConKey = mkPreludeTyConUnique 28
1484 mutableByteArrayPrimTyConKey = mkPreludeTyConUnique 29
1485 orderingTyConKey = mkPreludeTyConUnique 30
1486 mVarPrimTyConKey = mkPreludeTyConUnique 31
1487 ratioTyConKey = mkPreludeTyConUnique 32
1488 rationalTyConKey = mkPreludeTyConUnique 33
1489 realWorldTyConKey = mkPreludeTyConUnique 34
1490 stablePtrPrimTyConKey = mkPreludeTyConUnique 35
1491 stablePtrTyConKey = mkPreludeTyConUnique 36
1492 anyTyConKey = mkPreludeTyConUnique 37
1493 eqTyConKey = mkPreludeTyConUnique 38
1494 arrayArrayPrimTyConKey = mkPreludeTyConUnique 39
1495 mutableArrayArrayPrimTyConKey = mkPreludeTyConUnique 40
1496
1497 statePrimTyConKey, stableNamePrimTyConKey, stableNameTyConKey,
1498 mutVarPrimTyConKey, ioTyConKey,
1499 wordPrimTyConKey, wordTyConKey, word8TyConKey, word16TyConKey,
1500 word32PrimTyConKey, word32TyConKey, word64PrimTyConKey, word64TyConKey,
1501 liftedConKey, unliftedConKey, anyBoxConKey, kindConKey, boxityConKey,
1502 typeConKey, threadIdPrimTyConKey, bcoPrimTyConKey, ptrTyConKey,
1503 funPtrTyConKey, tVarPrimTyConKey, eqPrimTyConKey,
1504 eqReprPrimTyConKey, voidPrimTyConKey :: Unique
1505 statePrimTyConKey = mkPreludeTyConUnique 50
1506 stableNamePrimTyConKey = mkPreludeTyConUnique 51
1507 stableNameTyConKey = mkPreludeTyConUnique 52
1508 eqPrimTyConKey = mkPreludeTyConUnique 53
1509 eqReprPrimTyConKey = mkPreludeTyConUnique 54
1510 mutVarPrimTyConKey = mkPreludeTyConUnique 55
1511 ioTyConKey = mkPreludeTyConUnique 56
1512 voidPrimTyConKey = mkPreludeTyConUnique 57
1513 wordPrimTyConKey = mkPreludeTyConUnique 58
1514 wordTyConKey = mkPreludeTyConUnique 59
1515 word8TyConKey = mkPreludeTyConUnique 60
1516 word16TyConKey = mkPreludeTyConUnique 61
1517 word32PrimTyConKey = mkPreludeTyConUnique 62
1518 word32TyConKey = mkPreludeTyConUnique 63
1519 word64PrimTyConKey = mkPreludeTyConUnique 64
1520 word64TyConKey = mkPreludeTyConUnique 65
1521 liftedConKey = mkPreludeTyConUnique 66
1522 unliftedConKey = mkPreludeTyConUnique 67
1523 anyBoxConKey = mkPreludeTyConUnique 68
1524 kindConKey = mkPreludeTyConUnique 69
1525 boxityConKey = mkPreludeTyConUnique 70
1526 typeConKey = mkPreludeTyConUnique 71
1527 threadIdPrimTyConKey = mkPreludeTyConUnique 72
1528 bcoPrimTyConKey = mkPreludeTyConUnique 73
1529 ptrTyConKey = mkPreludeTyConUnique 74
1530 funPtrTyConKey = mkPreludeTyConUnique 75
1531 tVarPrimTyConKey = mkPreludeTyConUnique 76
1532
1533 -- Parallel array type constructor
1534 parrTyConKey :: Unique
1535 parrTyConKey = mkPreludeTyConUnique 82
1536
1537 -- dotnet interop
1538 objectTyConKey :: Unique
1539 objectTyConKey = mkPreludeTyConUnique 83
1540
1541 eitherTyConKey :: Unique
1542 eitherTyConKey = mkPreludeTyConUnique 84
1543
1544 -- Super Kinds constructors
1545 superKindTyConKey :: Unique
1546 superKindTyConKey = mkPreludeTyConUnique 85
1547
1548 -- Kind constructors
1549 liftedTypeKindTyConKey, anyKindTyConKey, openTypeKindTyConKey,
1550 unliftedTypeKindTyConKey, constraintKindTyConKey :: Unique
1551 anyKindTyConKey = mkPreludeTyConUnique 86
1552 liftedTypeKindTyConKey = mkPreludeTyConUnique 87
1553 openTypeKindTyConKey = mkPreludeTyConUnique 88
1554 unliftedTypeKindTyConKey = mkPreludeTyConUnique 89
1555 constraintKindTyConKey = mkPreludeTyConUnique 92
1556
1557 -- Coercion constructors
1558 symCoercionTyConKey, transCoercionTyConKey, leftCoercionTyConKey,
1559 rightCoercionTyConKey, instCoercionTyConKey, unsafeCoercionTyConKey,
1560 csel1CoercionTyConKey, csel2CoercionTyConKey, cselRCoercionTyConKey
1561 :: Unique
1562 symCoercionTyConKey = mkPreludeTyConUnique 93
1563 transCoercionTyConKey = mkPreludeTyConUnique 94
1564 leftCoercionTyConKey = mkPreludeTyConUnique 95
1565 rightCoercionTyConKey = mkPreludeTyConUnique 96
1566 instCoercionTyConKey = mkPreludeTyConUnique 97
1567 unsafeCoercionTyConKey = mkPreludeTyConUnique 98
1568 csel1CoercionTyConKey = mkPreludeTyConUnique 99
1569 csel2CoercionTyConKey = mkPreludeTyConUnique 100
1570 cselRCoercionTyConKey = mkPreludeTyConUnique 101
1571
1572 pluginTyConKey :: Unique
1573 pluginTyConKey = mkPreludeTyConUnique 102
1574
1575 unknownTyConKey, unknown1TyConKey, unknown2TyConKey, unknown3TyConKey,
1576 opaqueTyConKey :: Unique
1577 unknownTyConKey = mkPreludeTyConUnique 129
1578 unknown1TyConKey = mkPreludeTyConUnique 130
1579 unknown2TyConKey = mkPreludeTyConUnique 131
1580 unknown3TyConKey = mkPreludeTyConUnique 132
1581 opaqueTyConKey = mkPreludeTyConUnique 133
1582
1583 -- Generics (Unique keys)
1584 v1TyConKey, u1TyConKey, par1TyConKey, rec1TyConKey,
1585 k1TyConKey, m1TyConKey, sumTyConKey, prodTyConKey,
1586 compTyConKey, rTyConKey, pTyConKey, dTyConKey,
1587 cTyConKey, sTyConKey, rec0TyConKey, par0TyConKey,
1588 d1TyConKey, c1TyConKey, s1TyConKey, noSelTyConKey,
1589 repTyConKey, rep1TyConKey, uRecTyConKey,
1590 uAddrTyConKey, uCharTyConKey, uDoubleTyConKey,
1591 uFloatTyConKey, uIntTyConKey, uWordTyConKey :: Unique
1592
1593 v1TyConKey = mkPreludeTyConUnique 135
1594 u1TyConKey = mkPreludeTyConUnique 136
1595 par1TyConKey = mkPreludeTyConUnique 137
1596 rec1TyConKey = mkPreludeTyConUnique 138
1597 k1TyConKey = mkPreludeTyConUnique 139
1598 m1TyConKey = mkPreludeTyConUnique 140
1599
1600 sumTyConKey = mkPreludeTyConUnique 141
1601 prodTyConKey = mkPreludeTyConUnique 142
1602 compTyConKey = mkPreludeTyConUnique 143
1603
1604 rTyConKey = mkPreludeTyConUnique 144
1605 pTyConKey = mkPreludeTyConUnique 145
1606 dTyConKey = mkPreludeTyConUnique 146
1607 cTyConKey = mkPreludeTyConUnique 147
1608 sTyConKey = mkPreludeTyConUnique 148
1609
1610 rec0TyConKey = mkPreludeTyConUnique 149
1611 par0TyConKey = mkPreludeTyConUnique 150
1612 d1TyConKey = mkPreludeTyConUnique 151
1613 c1TyConKey = mkPreludeTyConUnique 152
1614 s1TyConKey = mkPreludeTyConUnique 153
1615 noSelTyConKey = mkPreludeTyConUnique 154
1616
1617 repTyConKey = mkPreludeTyConUnique 155
1618 rep1TyConKey = mkPreludeTyConUnique 156
1619
1620 uRecTyConKey = mkPreludeTyConUnique 157
1621 uAddrTyConKey = mkPreludeTyConUnique 158
1622 uCharTyConKey = mkPreludeTyConUnique 159
1623 uDoubleTyConKey = mkPreludeTyConUnique 160
1624 uFloatTyConKey = mkPreludeTyConUnique 161
1625 uIntTyConKey = mkPreludeTyConUnique 162
1626 uWordTyConKey = mkPreludeTyConUnique 163
1627
1628 -- Type-level naturals
1629 typeNatKindConNameKey, typeSymbolKindConNameKey,
1630 typeNatAddTyFamNameKey, typeNatMulTyFamNameKey, typeNatExpTyFamNameKey,
1631 typeNatLeqTyFamNameKey, typeNatSubTyFamNameKey
1632 , typeSymbolCmpTyFamNameKey, typeNatCmpTyFamNameKey
1633 :: Unique
1634 typeNatKindConNameKey = mkPreludeTyConUnique 164
1635 typeSymbolKindConNameKey = mkPreludeTyConUnique 165
1636 typeNatAddTyFamNameKey = mkPreludeTyConUnique 166
1637 typeNatMulTyFamNameKey = mkPreludeTyConUnique 167
1638 typeNatExpTyFamNameKey = mkPreludeTyConUnique 168
1639 typeNatLeqTyFamNameKey = mkPreludeTyConUnique 169
1640 typeNatSubTyFamNameKey = mkPreludeTyConUnique 170
1641 typeSymbolCmpTyFamNameKey = mkPreludeTyConUnique 171
1642 typeNatCmpTyFamNameKey = mkPreludeTyConUnique 172
1643
1644 -- Custom user type-errors
1645 errorMessageTypeErrorFamKey :: Unique
1646 errorMessageTypeErrorFamKey = mkPreludeTyConUnique 173
1647
1648
1649
1650 ntTyConKey:: Unique
1651 ntTyConKey = mkPreludeTyConUnique 174
1652 coercibleTyConKey :: Unique
1653 coercibleTyConKey = mkPreludeTyConUnique 175
1654
1655 proxyPrimTyConKey :: Unique
1656 proxyPrimTyConKey = mkPreludeTyConUnique 176
1657
1658 specTyConKey :: Unique
1659 specTyConKey = mkPreludeTyConUnique 177
1660
1661 smallArrayPrimTyConKey = mkPreludeTyConUnique 178
1662 smallMutableArrayPrimTyConKey = mkPreludeTyConUnique 179
1663
1664 staticPtrTyConKey :: Unique
1665 staticPtrTyConKey = mkPreludeTyConUnique 180
1666
1667 staticPtrInfoTyConKey :: Unique
1668 staticPtrInfoTyConKey = mkPreludeTyConUnique 181
1669
1670 callStackTyConKey :: Unique
1671 callStackTyConKey = mkPreludeTyConUnique 182
1672
1673 -- Typeables
1674 typeRepTyConKey :: Unique
1675 typeRepTyConKey = mkPreludeTyConUnique 183
1676
1677 -- Implicit Parameters
1678 ipTyConKey :: Unique
1679 ipTyConKey = mkPreludeTyConUnique 184
1680
1681 ipCoNameKey :: Unique
1682 ipCoNameKey = mkPreludeTyConUnique 185
1683
1684
1685 ---------------- Template Haskell -------------------
1686 -- THNames.hs: USES TyConUniques 200-299
1687 -----------------------------------------------------
1688
1689 ----------------------- SIMD ------------------------
1690 -- USES TyConUniques 300-399
1691 -----------------------------------------------------
1692
1693 #include "primop-vector-uniques.hs-incl"
1694
1695 {-
1696 ************************************************************************
1697 * *
1698 \subsubsection[Uniques-prelude-DataCons]{@Uniques@ for wired-in @DataCons@}
1699 * *
1700 ************************************************************************
1701 -}
1702
1703 charDataConKey, consDataConKey, doubleDataConKey, falseDataConKey,
1704 floatDataConKey, intDataConKey, integerSDataConKey, nilDataConKey,
1705 ratioDataConKey, stableNameDataConKey, trueDataConKey, wordDataConKey,
1706 word8DataConKey, ioDataConKey, integerDataConKey, eqBoxDataConKey,
1707 coercibleDataConKey, nothingDataConKey, justDataConKey :: Unique
1708 charDataConKey = mkPreludeDataConUnique 1
1709 consDataConKey = mkPreludeDataConUnique 2
1710 doubleDataConKey = mkPreludeDataConUnique 3
1711 falseDataConKey = mkPreludeDataConUnique 4
1712 floatDataConKey = mkPreludeDataConUnique 5
1713 intDataConKey = mkPreludeDataConUnique 6
1714 integerSDataConKey = mkPreludeDataConUnique 7
1715 nothingDataConKey = mkPreludeDataConUnique 8
1716 justDataConKey = mkPreludeDataConUnique 9
1717 nilDataConKey = mkPreludeDataConUnique 11
1718 ratioDataConKey = mkPreludeDataConUnique 12
1719 word8DataConKey = mkPreludeDataConUnique 13
1720 stableNameDataConKey = mkPreludeDataConUnique 14
1721 trueDataConKey = mkPreludeDataConUnique 15
1722 wordDataConKey = mkPreludeDataConUnique 16
1723 ioDataConKey = mkPreludeDataConUnique 17
1724 integerDataConKey = mkPreludeDataConUnique 18
1725 eqBoxDataConKey = mkPreludeDataConUnique 19
1726
1727 -- Generic data constructors
1728 crossDataConKey, inlDataConKey, inrDataConKey, genUnitDataConKey :: Unique
1729 crossDataConKey = mkPreludeDataConUnique 20
1730 inlDataConKey = mkPreludeDataConUnique 21
1731 inrDataConKey = mkPreludeDataConUnique 22
1732 genUnitDataConKey = mkPreludeDataConUnique 23
1733
1734 -- Data constructor for parallel arrays
1735 parrDataConKey :: Unique
1736 parrDataConKey = mkPreludeDataConUnique 24
1737
1738 leftDataConKey, rightDataConKey :: Unique
1739 leftDataConKey = mkPreludeDataConUnique 25
1740 rightDataConKey = mkPreludeDataConUnique 26
1741
1742 ltDataConKey, eqDataConKey, gtDataConKey :: Unique
1743 ltDataConKey = mkPreludeDataConUnique 27
1744 eqDataConKey = mkPreludeDataConUnique 28
1745 gtDataConKey = mkPreludeDataConUnique 29
1746
1747 coercibleDataConKey = mkPreludeDataConUnique 32
1748
1749 staticPtrDataConKey :: Unique
1750 staticPtrDataConKey = mkPreludeDataConUnique 33
1751
1752 staticPtrInfoDataConKey :: Unique
1753 staticPtrInfoDataConKey = mkPreludeDataConUnique 34
1754
1755 fingerprintDataConKey :: Unique
1756 fingerprintDataConKey = mkPreludeDataConUnique 35
1757
1758 callStackDataConKey, srcLocDataConKey :: Unique
1759 callStackDataConKey = mkPreludeDataConUnique 36
1760 srcLocDataConKey = mkPreludeDataConUnique 37
1761
1762 ipDataConKey :: Unique
1763 ipDataConKey = mkPreludeDataConUnique 38
1764
1765 trTyConDataConKey, trModuleDataConKey, trNameSDataConKey :: Unique
1766 trTyConDataConKey = mkPreludeDataConUnique 40
1767 trModuleDataConKey = mkPreludeDataConUnique 41
1768 trNameSDataConKey = mkPreludeDataConUnique 42
1769
1770 typeErrorTextDataConKey,
1771 typeErrorAppendDataConKey,
1772 typeErrorVAppendDataConKey,
1773 typeErrorShowTypeDataConKey
1774 :: Unique
1775 typeErrorTextDataConKey = mkPreludeDataConUnique 50
1776 typeErrorAppendDataConKey = mkPreludeDataConUnique 51
1777 typeErrorVAppendDataConKey = mkPreludeDataConUnique 52
1778 typeErrorShowTypeDataConKey = mkPreludeDataConUnique 53
1779
1780 ---------------- Template Haskell -------------------
1781 -- THNames.hs: USES DataUniques 100-150
1782 -----------------------------------------------------
1783
1784
1785 {-
1786 ************************************************************************
1787 * *
1788 \subsubsection[Uniques-prelude-Ids]{@Uniques@ for wired-in @Ids@ (except @DataCons@)}
1789 * *
1790 ************************************************************************
1791 -}
1792
1793 wildCardKey, absentErrorIdKey, augmentIdKey, appendIdKey,
1794 buildIdKey, errorIdKey, foldrIdKey, recSelErrorIdKey,
1795 seqIdKey, irrefutPatErrorIdKey, eqStringIdKey,
1796 noMethodBindingErrorIdKey, nonExhaustiveGuardsErrorIdKey,
1797 runtimeErrorIdKey, patErrorIdKey, voidPrimIdKey,
1798 realWorldPrimIdKey, recConErrorIdKey,
1799 unpackCStringUtf8IdKey, unpackCStringAppendIdKey,
1800 unpackCStringFoldrIdKey, unpackCStringIdKey,
1801 typeErrorIdKey :: Unique
1802
1803 wildCardKey = mkPreludeMiscIdUnique 0 -- See Note [WildCard binders]
1804 absentErrorIdKey = mkPreludeMiscIdUnique 1
1805 augmentIdKey = mkPreludeMiscIdUnique 2
1806 appendIdKey = mkPreludeMiscIdUnique 3
1807 buildIdKey = mkPreludeMiscIdUnique 4
1808 errorIdKey = mkPreludeMiscIdUnique 5
1809 foldrIdKey = mkPreludeMiscIdUnique 6
1810 recSelErrorIdKey = mkPreludeMiscIdUnique 7
1811 seqIdKey = mkPreludeMiscIdUnique 8
1812 irrefutPatErrorIdKey = mkPreludeMiscIdUnique 9
1813 eqStringIdKey = mkPreludeMiscIdUnique 10
1814 noMethodBindingErrorIdKey = mkPreludeMiscIdUnique 11
1815 nonExhaustiveGuardsErrorIdKey = mkPreludeMiscIdUnique 12
1816 runtimeErrorIdKey = mkPreludeMiscIdUnique 13
1817 patErrorIdKey = mkPreludeMiscIdUnique 14
1818 realWorldPrimIdKey = mkPreludeMiscIdUnique 15
1819 recConErrorIdKey = mkPreludeMiscIdUnique 16
1820 unpackCStringUtf8IdKey = mkPreludeMiscIdUnique 17
1821 unpackCStringAppendIdKey = mkPreludeMiscIdUnique 18
1822 unpackCStringFoldrIdKey = mkPreludeMiscIdUnique 19
1823 unpackCStringIdKey = mkPreludeMiscIdUnique 20
1824 voidPrimIdKey = mkPreludeMiscIdUnique 21
1825 typeErrorIdKey = mkPreludeMiscIdUnique 22
1826
1827 unsafeCoerceIdKey, concatIdKey, filterIdKey, zipIdKey, bindIOIdKey,
1828 returnIOIdKey, newStablePtrIdKey,
1829 printIdKey, failIOIdKey, nullAddrIdKey, voidArgIdKey,
1830 fstIdKey, sndIdKey, otherwiseIdKey, assertIdKey :: Unique
1831 unsafeCoerceIdKey = mkPreludeMiscIdUnique 30
1832 concatIdKey = mkPreludeMiscIdUnique 31
1833 filterIdKey = mkPreludeMiscIdUnique 32
1834 zipIdKey = mkPreludeMiscIdUnique 33
1835 bindIOIdKey = mkPreludeMiscIdUnique 34
1836 returnIOIdKey = mkPreludeMiscIdUnique 35
1837 newStablePtrIdKey = mkPreludeMiscIdUnique 36
1838 printIdKey = mkPreludeMiscIdUnique 37
1839 failIOIdKey = mkPreludeMiscIdUnique 38
1840 nullAddrIdKey = mkPreludeMiscIdUnique 39
1841 voidArgIdKey = mkPreludeMiscIdUnique 40
1842 fstIdKey = mkPreludeMiscIdUnique 41
1843 sndIdKey = mkPreludeMiscIdUnique 42
1844 otherwiseIdKey = mkPreludeMiscIdUnique 43
1845 assertIdKey = mkPreludeMiscIdUnique 44
1846
1847 mkIntegerIdKey, smallIntegerIdKey, wordToIntegerIdKey,
1848 integerToWordIdKey, integerToIntIdKey,
1849 integerToWord64IdKey, integerToInt64IdKey,
1850 word64ToIntegerIdKey, int64ToIntegerIdKey,
1851 plusIntegerIdKey, timesIntegerIdKey, minusIntegerIdKey,
1852 negateIntegerIdKey,
1853 eqIntegerPrimIdKey, neqIntegerPrimIdKey, absIntegerIdKey, signumIntegerIdKey,
1854 leIntegerPrimIdKey, gtIntegerPrimIdKey, ltIntegerPrimIdKey, geIntegerPrimIdKey,
1855 compareIntegerIdKey, quotRemIntegerIdKey, divModIntegerIdKey,
1856 quotIntegerIdKey, remIntegerIdKey, divIntegerIdKey, modIntegerIdKey,
1857 floatFromIntegerIdKey, doubleFromIntegerIdKey,
1858 encodeFloatIntegerIdKey, encodeDoubleIntegerIdKey,
1859 decodeDoubleIntegerIdKey,
1860 gcdIntegerIdKey, lcmIntegerIdKey,
1861 andIntegerIdKey, orIntegerIdKey, xorIntegerIdKey, complementIntegerIdKey,
1862 shiftLIntegerIdKey, shiftRIntegerIdKey :: Unique
1863 mkIntegerIdKey = mkPreludeMiscIdUnique 60
1864 smallIntegerIdKey = mkPreludeMiscIdUnique 61
1865 integerToWordIdKey = mkPreludeMiscIdUnique 62
1866 integerToIntIdKey = mkPreludeMiscIdUnique 63
1867 integerToWord64IdKey = mkPreludeMiscIdUnique 64
1868 integerToInt64IdKey = mkPreludeMiscIdUnique 65
1869 plusIntegerIdKey = mkPreludeMiscIdUnique 66
1870 timesIntegerIdKey = mkPreludeMiscIdUnique 67
1871 minusIntegerIdKey = mkPreludeMiscIdUnique 68
1872 negateIntegerIdKey = mkPreludeMiscIdUnique 69
1873 eqIntegerPrimIdKey = mkPreludeMiscIdUnique 70
1874 neqIntegerPrimIdKey = mkPreludeMiscIdUnique 71
1875 absIntegerIdKey = mkPreludeMiscIdUnique 72
1876 signumIntegerIdKey = mkPreludeMiscIdUnique 73
1877 leIntegerPrimIdKey = mkPreludeMiscIdUnique 74
1878 gtIntegerPrimIdKey = mkPreludeMiscIdUnique 75
1879 ltIntegerPrimIdKey = mkPreludeMiscIdUnique 76
1880 geIntegerPrimIdKey = mkPreludeMiscIdUnique 77
1881 compareIntegerIdKey = mkPreludeMiscIdUnique 78
1882 quotIntegerIdKey = mkPreludeMiscIdUnique 79
1883 remIntegerIdKey = mkPreludeMiscIdUnique 80
1884 divIntegerIdKey = mkPreludeMiscIdUnique 81
1885 modIntegerIdKey = mkPreludeMiscIdUnique 82
1886 divModIntegerIdKey = mkPreludeMiscIdUnique 83
1887 quotRemIntegerIdKey = mkPreludeMiscIdUnique 84
1888 floatFromIntegerIdKey = mkPreludeMiscIdUnique 85
1889 doubleFromIntegerIdKey = mkPreludeMiscIdUnique 86
1890 encodeFloatIntegerIdKey = mkPreludeMiscIdUnique 87
1891 encodeDoubleIntegerIdKey = mkPreludeMiscIdUnique 88
1892 gcdIntegerIdKey = mkPreludeMiscIdUnique 89
1893 lcmIntegerIdKey = mkPreludeMiscIdUnique 90
1894 andIntegerIdKey = mkPreludeMiscIdUnique 91
1895 orIntegerIdKey = mkPreludeMiscIdUnique 92
1896 xorIntegerIdKey = mkPreludeMiscIdUnique 93
1897 complementIntegerIdKey = mkPreludeMiscIdUnique 94
1898 shiftLIntegerIdKey = mkPreludeMiscIdUnique 95
1899 shiftRIntegerIdKey = mkPreludeMiscIdUnique 96
1900 wordToIntegerIdKey = mkPreludeMiscIdUnique 97
1901 word64ToIntegerIdKey = mkPreludeMiscIdUnique 98
1902 int64ToIntegerIdKey = mkPreludeMiscIdUnique 99
1903 decodeDoubleIntegerIdKey = mkPreludeMiscIdUnique 100
1904
1905 rootMainKey, runMainKey :: Unique
1906 rootMainKey = mkPreludeMiscIdUnique 101
1907 runMainKey = mkPreludeMiscIdUnique 102
1908
1909 thenIOIdKey, lazyIdKey, assertErrorIdKey, oneShotKey, runRWKey :: Unique
1910 thenIOIdKey = mkPreludeMiscIdUnique 103
1911 lazyIdKey = mkPreludeMiscIdUnique 104
1912 assertErrorIdKey = mkPreludeMiscIdUnique 105
1913 oneShotKey = mkPreludeMiscIdUnique 106
1914 runRWKey = mkPreludeMiscIdUnique 107
1915
1916 breakpointIdKey, breakpointCondIdKey, breakpointAutoIdKey,
1917 breakpointJumpIdKey, breakpointCondJumpIdKey,
1918 breakpointAutoJumpIdKey :: Unique
1919 breakpointIdKey = mkPreludeMiscIdUnique 110
1920 breakpointCondIdKey = mkPreludeMiscIdUnique 111
1921 breakpointAutoIdKey = mkPreludeMiscIdUnique 112
1922 breakpointJumpIdKey = mkPreludeMiscIdUnique 113
1923 breakpointCondJumpIdKey = mkPreludeMiscIdUnique 114
1924 breakpointAutoJumpIdKey = mkPreludeMiscIdUnique 115
1925
1926 inlineIdKey :: Unique
1927 inlineIdKey = mkPreludeMiscIdUnique 120
1928
1929 mapIdKey, groupWithIdKey, dollarIdKey :: Unique
1930 mapIdKey = mkPreludeMiscIdUnique 121
1931 groupWithIdKey = mkPreludeMiscIdUnique 122
1932 dollarIdKey = mkPreludeMiscIdUnique 123
1933
1934 coercionTokenIdKey :: Unique
1935 coercionTokenIdKey = mkPreludeMiscIdUnique 124
1936
1937 rationalToFloatIdKey, rationalToDoubleIdKey :: Unique
1938 rationalToFloatIdKey = mkPreludeMiscIdUnique 130
1939 rationalToDoubleIdKey = mkPreludeMiscIdUnique 131
1940
1941 -- dotnet interop
1942 unmarshalObjectIdKey, marshalObjectIdKey, marshalStringIdKey,
1943 unmarshalStringIdKey, checkDotnetResNameIdKey :: Unique
1944 unmarshalObjectIdKey = mkPreludeMiscIdUnique 150
1945 marshalObjectIdKey = mkPreludeMiscIdUnique 151
1946 marshalStringIdKey = mkPreludeMiscIdUnique 152
1947 unmarshalStringIdKey = mkPreludeMiscIdUnique 153
1948 checkDotnetResNameIdKey = mkPreludeMiscIdUnique 154
1949
1950 undefinedKey :: Unique
1951 undefinedKey = mkPreludeMiscIdUnique 155
1952
1953 magicDictKey :: Unique
1954 magicDictKey = mkPreludeMiscIdUnique 156
1955
1956 coerceKey :: Unique
1957 coerceKey = mkPreludeMiscIdUnique 157
1958
1959 {-
1960 Certain class operations from Prelude classes. They get their own
1961 uniques so we can look them up easily when we want to conjure them up
1962 during type checking.
1963 -}
1964
1965 -- Just a placeholder for unbound variables produced by the renamer:
1966 unboundKey :: Unique
1967 unboundKey = mkPreludeMiscIdUnique 158
1968
1969 fromIntegerClassOpKey, minusClassOpKey, fromRationalClassOpKey,
1970 enumFromClassOpKey, enumFromThenClassOpKey, enumFromToClassOpKey,
1971 enumFromThenToClassOpKey, eqClassOpKey, geClassOpKey, negateClassOpKey,
1972 failMClassOpKey_preMFP, bindMClassOpKey, thenMClassOpKey, returnMClassOpKey,
1973 fmapClassOpKey
1974 :: Unique
1975 fromIntegerClassOpKey = mkPreludeMiscIdUnique 160
1976 minusClassOpKey = mkPreludeMiscIdUnique 161
1977 fromRationalClassOpKey = mkPreludeMiscIdUnique 162
1978 enumFromClassOpKey = mkPreludeMiscIdUnique 163
1979 enumFromThenClassOpKey = mkPreludeMiscIdUnique 164
1980 enumFromToClassOpKey = mkPreludeMiscIdUnique 165
1981 enumFromThenToClassOpKey = mkPreludeMiscIdUnique 166
1982 eqClassOpKey = mkPreludeMiscIdUnique 167
1983 geClassOpKey = mkPreludeMiscIdUnique 168
1984 negateClassOpKey = mkPreludeMiscIdUnique 169
1985 failMClassOpKey_preMFP = mkPreludeMiscIdUnique 170
1986 bindMClassOpKey = mkPreludeMiscIdUnique 171 -- (>>=)
1987 thenMClassOpKey = mkPreludeMiscIdUnique 172 -- (>>)
1988 fmapClassOpKey = mkPreludeMiscIdUnique 173
1989 returnMClassOpKey = mkPreludeMiscIdUnique 174
1990
1991 -- Recursive do notation
1992 mfixIdKey :: Unique
1993 mfixIdKey = mkPreludeMiscIdUnique 175
1994
1995 -- MonadFail operations
1996 failMClassOpKey :: Unique
1997 failMClassOpKey = mkPreludeMiscIdUnique 176
1998
1999 -- Arrow notation
2000 arrAIdKey, composeAIdKey, firstAIdKey, appAIdKey, choiceAIdKey,
2001 loopAIdKey :: Unique
2002 arrAIdKey = mkPreludeMiscIdUnique 180
2003 composeAIdKey = mkPreludeMiscIdUnique 181 -- >>>
2004 firstAIdKey = mkPreludeMiscIdUnique 182
2005 appAIdKey = mkPreludeMiscIdUnique 183
2006 choiceAIdKey = mkPreludeMiscIdUnique 184 -- |||
2007 loopAIdKey = mkPreludeMiscIdUnique 185
2008
2009 fromStringClassOpKey :: Unique
2010 fromStringClassOpKey = mkPreludeMiscIdUnique 186
2011
2012 -- Annotation type checking
2013 toAnnotationWrapperIdKey :: Unique
2014 toAnnotationWrapperIdKey = mkPreludeMiscIdUnique 187
2015
2016 -- Conversion functions
2017 fromIntegralIdKey, realToFracIdKey, toIntegerClassOpKey, toRationalClassOpKey :: Unique
2018 fromIntegralIdKey = mkPreludeMiscIdUnique 190
2019 realToFracIdKey = mkPreludeMiscIdUnique 191
2020 toIntegerClassOpKey = mkPreludeMiscIdUnique 192
2021 toRationalClassOpKey = mkPreludeMiscIdUnique 193
2022
2023 -- Monad comprehensions
2024 guardMIdKey, liftMIdKey, mzipIdKey :: Unique
2025 guardMIdKey = mkPreludeMiscIdUnique 194
2026 liftMIdKey = mkPreludeMiscIdUnique 195
2027 mzipIdKey = mkPreludeMiscIdUnique 196
2028
2029 -- GHCi
2030 ghciStepIoMClassOpKey :: Unique
2031 ghciStepIoMClassOpKey = mkPreludeMiscIdUnique 197
2032
2033 -- Overloaded lists
2034 isListClassKey, fromListClassOpKey, fromListNClassOpKey, toListClassOpKey :: Unique
2035 isListClassKey = mkPreludeMiscIdUnique 198
2036 fromListClassOpKey = mkPreludeMiscIdUnique 199
2037 fromListNClassOpKey = mkPreludeMiscIdUnique 500
2038 toListClassOpKey = mkPreludeMiscIdUnique 501
2039
2040 proxyHashKey :: Unique
2041 proxyHashKey = mkPreludeMiscIdUnique 502
2042
2043 ---------------- Template Haskell -------------------
2044 -- THNames.hs: USES IdUniques 200-499
2045 -----------------------------------------------------
2046
2047 -- Used to make `Typeable` dictionaries
2048 mkTyConKey
2049 , mkPolyTyConAppKey
2050 , mkAppTyKey
2051 , typeNatTypeRepKey
2052 , typeSymbolTypeRepKey
2053 , typeRepIdKey
2054 :: Unique
2055 mkTyConKey = mkPreludeMiscIdUnique 503
2056 mkPolyTyConAppKey = mkPreludeMiscIdUnique 504
2057 mkAppTyKey = mkPreludeMiscIdUnique 505
2058 typeNatTypeRepKey = mkPreludeMiscIdUnique 506
2059 typeSymbolTypeRepKey = mkPreludeMiscIdUnique 507
2060 typeRepIdKey = mkPreludeMiscIdUnique 508
2061
2062 -- Dynamic
2063 toDynIdKey :: Unique
2064 toDynIdKey = mkPreludeMiscIdUnique 509
2065
2066 bitIntegerIdKey :: Unique
2067 bitIntegerIdKey = mkPreludeMiscIdUnique 510
2068
2069
2070 {-
2071 ************************************************************************
2072 * *
2073 \subsection[Class-std-groups]{Standard groups of Prelude classes}
2074 * *
2075 ************************************************************************
2076
2077 NOTE: @Eq@ and @Text@ do need to appear in @standardClasses@
2078 even though every numeric class has these two as a superclass,
2079 because the list of ambiguous dictionaries hasn't been simplified.
2080 -}
2081
2082 numericClassKeys :: [Unique]
2083 numericClassKeys =
2084 [ numClassKey
2085 , realClassKey
2086 , integralClassKey
2087 ]
2088 ++ fractionalClassKeys
2089
2090 fractionalClassKeys :: [Unique]
2091 fractionalClassKeys =
2092 [ fractionalClassKey
2093 , floatingClassKey
2094 , realFracClassKey
2095 , realFloatClassKey
2096 ]
2097
2098 -- The "standard classes" are used in defaulting (Haskell 98 report 4.3.4),
2099 -- and are: "classes defined in the Prelude or a standard library"
2100 standardClassKeys :: [Unique]
2101 standardClassKeys = derivableClassKeys ++ numericClassKeys
2102 ++ [randomClassKey, randomGenClassKey,
2103 functorClassKey,
2104 monadClassKey, monadPlusClassKey, monadFailClassKey,
2105 isStringClassKey,
2106 applicativeClassKey, foldableClassKey,
2107 traversableClassKey, alternativeClassKey
2108 ]
2109
2110 {-
2111 @derivableClassKeys@ is also used in checking \tr{deriving} constructs
2112 (@TcDeriv@).
2113 -}
2114
2115 derivableClassKeys :: [Unique]
2116 derivableClassKeys
2117 = [ eqClassKey, ordClassKey, enumClassKey, ixClassKey,
2118 boundedClassKey, showClassKey, readClassKey ]