2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
4 \section[PrelNames]{Definitions of prelude modules and names}
7 Nota Bene: all Names defined in here should come from the base package
9 * ModuleNames for prelude modules,
10 e.g. pREL_BASE_Name :: ModuleName
12 * Modules for prelude modules
13 e.g. pREL_Base :: Module
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
20 * Names for Ids, DataCons, TyCons and Classes that the compiler
21 "knows about" in some way
22 e.g. intTyConName :: Name
24 One of these Names contains
25 (a) the module and occurrence name of the thing
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.
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
40 Unique, Uniquable(..), hasKey, -- Re-exported for convenience
42 -----------------------------------------------------------
43 module PrelNames, -- A huge bunch of (a) Names, e.g. intTyConName
44 -- (b) Uniques e.g. intTyConKey
45 -- (c) Groups of classes and types
46 -- (d) miscellaneous things
47 -- So many that we export them all
50 #include "HsVersions.h"
52 import Module ( Module, mkModule )
53 import OccName ( dataName, tcName, clsName, varName, mkOccNameFS,
55 import RdrName ( RdrName, nameRdrName, mkOrig, rdrNameOcc, mkUnqual )
56 import Unique ( Unique, Uniquable(..), hasKey,
57 mkPreludeMiscIdUnique, mkPreludeDataConUnique,
58 mkPreludeTyConUnique, mkPreludeClassUnique,
61 import BasicTypes ( Boxity(..), Arity )
62 import Name ( Name, mkInternalName, mkExternalName, nameModule )
63 import SrcLoc ( noSrcLoc )
68 %************************************************************************
70 \subsection{Local Names}
72 %************************************************************************
74 This *local* name is used by the interactive stuff
77 itName uniq = mkInternalName uniq (mkOccNameFS varName FSLIT("it")) noSrcLoc
81 -- mkUnboundName makes a place-holder Name; it shouldn't be looked at except possibly
82 -- during compiler debugging.
83 mkUnboundName :: RdrName -> Name
84 mkUnboundName rdr_name = mkInternalName unboundKey (rdrNameOcc rdr_name) noSrcLoc
86 isUnboundName :: Name -> Bool
87 isUnboundName name = name `hasKey` unboundKey
91 %************************************************************************
93 \subsection{Known key Names}
95 %************************************************************************
97 This section tells what the compiler knows about the assocation of
98 names with uniques. These ones are the *non* wired-in ones. The
99 wired in ones are defined in TysWiredIn etc.
102 basicKnownKeyNames :: [Name]
105 ++ typeableClassNames
106 ++ [ -- Type constructors (synonyms especially)
107 ioTyConName, ioDataConName,
114 mutableByteArrayTyConName,
115 integerTyConName, smallIntegerDataConName, largeIntegerDataConName,
117 -- Classes. *Must* include:
118 -- classes that are grabbed by key (e.g., eqClassKey)
119 -- classes in "Class.standardClassKeys" (quite a few)
120 eqClassName, -- mentioned, derivable
121 ordClassName, -- derivable
122 boundedClassName, -- derivable
123 numClassName, -- mentioned, numeric
124 enumClassName, -- derivable
127 realClassName, -- numeric
128 integralClassName, -- numeric
129 fractionalClassName, -- numeric
130 floatingClassName, -- numeric
131 realFracClassName, -- numeric
132 realFloatClassName, -- numeric
136 negateName, minusName,
137 fromRationalName, fromIntegerName,
141 enumFromName, enumFromThenName,
142 enumFromThenToName, enumFromToName,
143 enumFromToPName, enumFromThenToPName,
146 thenIOName, bindIOName, returnIOName, failIOName,
147 failMName, bindMName, thenMName, returnMName,
153 arrAName, composeAName, firstAName,
154 appAName, choiceAName, loopAName,
169 unpackCStringName, unpackCStringAppendName,
170 unpackCStringFoldrName, unpackCStringUtf8Name,
173 concatName, filterName,
174 zipName, foldrName, buildName, augmentName, appendName,
176 -- Parallel array operations
177 nullPName, lengthPName, replicatePName, mapPName,
178 filterPName, zipPName, crossPName, indexPName,
179 toPName, bpermutePName, bpermuteDftPName, indexOfPName,
181 -- FFI primitive types that are not wired-in.
182 stablePtrTyConName, ptrTyConName, funPtrTyConName, addrTyConName,
183 int8TyConName, int16TyConName, int32TyConName, int64TyConName,
184 wordTyConName, word8TyConName, word16TyConName, word32TyConName, word64TyConName,
188 plusIntegerName, timesIntegerName,
189 eqStringName, assertName, breakpointName, assertErrorName,
191 printName, fstName, sndName,
194 monadFixClassName, mfixName,
197 splittableClassName, splitName,
200 randomClassName, randomGenClassName, monadPlusClassName,
206 , eitherTyConName, leftDataConName, rightDataConName
209 , objectTyConName, marshalObjectName, unmarshalObjectName
210 , marshalStringName, unmarshalStringName, checkDotnetResName
213 genericTyConNames :: [Name]
214 genericTyConNames = [crossTyConName, plusTyConName, genUnitTyConName]
218 %************************************************************************
220 \subsection{Module names}
222 %************************************************************************
225 --MetaHaskell Extension Add a new module here
227 pRELUDE = mkModule "Prelude"
228 gHC_PRIM = mkModule "GHC.Prim" -- Primitive types and values
229 pREL_BASE = mkModule "GHC.Base"
230 pREL_ENUM = mkModule "GHC.Enum"
231 pREL_SHOW = mkModule "GHC.Show"
232 pREL_READ = mkModule "GHC.Read"
233 pREL_NUM = mkModule "GHC.Num"
234 pREL_LIST = mkModule "GHC.List"
235 pREL_PARR = mkModule "GHC.PArr"
236 pREL_TUP = mkModule "Data.Tuple"
237 pREL_EITHER = mkModule "Data.Either"
238 pREL_PACK = mkModule "GHC.Pack"
239 pREL_CONC = mkModule "GHC.Conc"
240 pREL_IO_BASE = mkModule "GHC.IOBase"
241 pREL_ST = mkModule "GHC.ST"
242 pREL_ARR = mkModule "GHC.Arr"
243 pREL_BYTEARR = mkModule "PrelByteArr"
244 pREL_STABLE = mkModule "GHC.Stable"
245 pREL_ADDR = mkModule "GHC.Addr"
246 pREL_PTR = mkModule "GHC.Ptr"
247 pREL_ERR = mkModule "GHC.Err"
248 pREL_REAL = mkModule "GHC.Real"
249 pREL_FLOAT = mkModule "GHC.Float"
250 pREL_TOP_HANDLER= mkModule "GHC.TopHandler"
251 sYSTEM_IO = mkModule "System.IO"
252 dYNAMIC = mkModule "Data.Dynamic"
253 tYPEABLE = mkModule "Data.Typeable"
254 gENERICS = mkModule "Data.Generics.Basics"
255 dOTNET = mkModule "GHC.Dotnet"
257 rEAD_PREC = mkModule "Text.ParserCombinators.ReadPrec"
258 lEX = mkModule "Text.Read.Lex"
260 mAIN = mkModule "Main"
261 pREL_INT = mkModule "GHC.Int"
262 pREL_WORD = mkModule "GHC.Word"
263 mONAD = mkModule "Control.Monad"
264 mONAD_FIX = mkModule "Control.Monad.Fix"
265 aRROW = mkModule "Control.Arrow"
266 aDDR = mkModule "Addr"
267 rANDOM = mkModule "System.Random"
269 gLA_EXTS = mkModule "GHC.Exts"
270 rOOT_MAIN = mkModule ":Main" -- Root module for initialisation
271 -- The ':xxx' makes a module name that the user can never
272 -- use himself. The z-encoding for ':' is "ZC", so the z-encoded
273 -- module name still starts with a capital letter, which keeps
274 -- the z-encoded version consistent.
276 iNTERACTIVE = mkModule ":Interactive"
277 thFAKE = mkModule ":THFake"
280 %************************************************************************
282 \subsection{Constructing the names of tuples
284 %************************************************************************
287 mkTupleModule :: Boxity -> Arity -> Module
288 mkTupleModule Boxed 0 = pREL_BASE
289 mkTupleModule Boxed _ = pREL_TUP
290 mkTupleModule Unboxed _ = gHC_PRIM
294 %************************************************************************
298 %************************************************************************
301 main_RDR_Unqual = mkUnqual varName FSLIT("main")
302 -- We definitely don't want an Orig RdrName, because
303 -- main might, in principle, be imported into module Main
305 eq_RDR = nameRdrName eqName
306 ge_RDR = nameRdrName geName
307 ne_RDR = varQual_RDR pREL_BASE FSLIT("/=")
308 le_RDR = varQual_RDR pREL_BASE FSLIT("<=")
309 gt_RDR = varQual_RDR pREL_BASE FSLIT(">")
310 compare_RDR = varQual_RDR pREL_BASE FSLIT("compare")
311 ltTag_RDR = dataQual_RDR pREL_BASE FSLIT("LT")
312 eqTag_RDR = dataQual_RDR pREL_BASE FSLIT("EQ")
313 gtTag_RDR = dataQual_RDR pREL_BASE FSLIT("GT")
315 eqClass_RDR = nameRdrName eqClassName
316 numClass_RDR = nameRdrName numClassName
317 ordClass_RDR = nameRdrName ordClassName
318 enumClass_RDR = nameRdrName enumClassName
319 monadClass_RDR = nameRdrName monadClassName
321 map_RDR = varQual_RDR pREL_BASE FSLIT("map")
322 append_RDR = varQual_RDR pREL_BASE FSLIT("++")
324 foldr_RDR = nameRdrName foldrName
325 build_RDR = nameRdrName buildName
326 returnM_RDR = nameRdrName returnMName
327 bindM_RDR = nameRdrName bindMName
328 failM_RDR = nameRdrName failMName
330 and_RDR = nameRdrName andName
332 left_RDR = nameRdrName leftDataConName
333 right_RDR = nameRdrName rightDataConName
335 fromEnum_RDR = varQual_RDR pREL_ENUM FSLIT("fromEnum")
336 toEnum_RDR = varQual_RDR pREL_ENUM FSLIT("toEnum")
338 enumFrom_RDR = nameRdrName enumFromName
339 enumFromTo_RDR = nameRdrName enumFromToName
340 enumFromThen_RDR = nameRdrName enumFromThenName
341 enumFromThenTo_RDR = nameRdrName enumFromThenToName
343 ratioDataCon_RDR = nameRdrName ratioDataConName
344 plusInteger_RDR = nameRdrName plusIntegerName
345 timesInteger_RDR = nameRdrName timesIntegerName
347 ioDataCon_RDR = nameRdrName ioDataConName
349 eqString_RDR = nameRdrName eqStringName
350 unpackCString_RDR = nameRdrName unpackCStringName
351 unpackCStringFoldr_RDR = nameRdrName unpackCStringFoldrName
352 unpackCStringUtf8_RDR = nameRdrName unpackCStringUtf8Name
354 newStablePtr_RDR = nameRdrName newStablePtrName
355 addrDataCon_RDR = dataQual_RDR aDDR FSLIT("A#")
356 wordDataCon_RDR = dataQual_RDR pREL_WORD FSLIT("W#")
358 bindIO_RDR = nameRdrName bindIOName
359 returnIO_RDR = nameRdrName returnIOName
361 fromInteger_RDR = nameRdrName fromIntegerName
362 fromRational_RDR = nameRdrName fromRationalName
363 minus_RDR = nameRdrName minusName
364 times_RDR = varQual_RDR pREL_NUM FSLIT("*")
365 plus_RDR = varQual_RDR pREL_NUM FSLIT("+")
367 compose_RDR = varQual_RDR pREL_BASE FSLIT(".")
369 not_RDR = varQual_RDR pREL_BASE FSLIT("not")
370 getTag_RDR = varQual_RDR pREL_BASE FSLIT("getTag")
371 succ_RDR = varQual_RDR pREL_ENUM FSLIT("succ")
372 pred_RDR = varQual_RDR pREL_ENUM FSLIT("pred")
373 minBound_RDR = varQual_RDR pREL_ENUM FSLIT("minBound")
374 maxBound_RDR = varQual_RDR pREL_ENUM FSLIT("maxBound")
375 range_RDR = varQual_RDR pREL_ARR FSLIT("range")
376 inRange_RDR = varQual_RDR pREL_ARR FSLIT("inRange")
377 index_RDR = varQual_RDR pREL_ARR FSLIT("index")
378 unsafeIndex_RDR = varQual_RDR pREL_ARR FSLIT("unsafeIndex")
379 unsafeRangeSize_RDR = varQual_RDR pREL_ARR FSLIT("unsafeRangeSize")
381 readList_RDR = varQual_RDR pREL_READ FSLIT("readList")
382 readListDefault_RDR = varQual_RDR pREL_READ FSLIT("readListDefault")
383 readListPrec_RDR = varQual_RDR pREL_READ FSLIT("readListPrec")
384 readListPrecDefault_RDR = varQual_RDR pREL_READ FSLIT("readListPrecDefault")
385 readPrec_RDR = varQual_RDR pREL_READ FSLIT("readPrec")
386 parens_RDR = varQual_RDR pREL_READ FSLIT("parens")
387 choose_RDR = varQual_RDR pREL_READ FSLIT("choose")
388 lexP_RDR = varQual_RDR pREL_READ FSLIT("lexP")
390 punc_RDR = dataQual_RDR lEX FSLIT("Punc")
391 ident_RDR = dataQual_RDR lEX FSLIT("Ident")
392 symbol_RDR = dataQual_RDR lEX FSLIT("Symbol")
394 step_RDR = varQual_RDR rEAD_PREC FSLIT("step")
395 alt_RDR = varQual_RDR rEAD_PREC FSLIT("+++")
396 reset_RDR = varQual_RDR rEAD_PREC FSLIT("reset")
397 prec_RDR = varQual_RDR rEAD_PREC FSLIT("prec")
399 showList_RDR = varQual_RDR pREL_SHOW FSLIT("showList")
400 showList___RDR = varQual_RDR pREL_SHOW FSLIT("showList__")
401 showsPrec_RDR = varQual_RDR pREL_SHOW FSLIT("showsPrec")
402 showString_RDR = varQual_RDR pREL_SHOW FSLIT("showString")
403 showSpace_RDR = varQual_RDR pREL_SHOW FSLIT("showSpace")
404 showParen_RDR = varQual_RDR pREL_SHOW FSLIT("showParen")
406 typeOf_RDR = varQual_RDR tYPEABLE FSLIT("typeOf")
407 mkTypeRep_RDR = varQual_RDR tYPEABLE FSLIT("mkTyConApp")
408 mkTyConRep_RDR = varQual_RDR tYPEABLE FSLIT("mkTyCon")
410 undefined_RDR = varQual_RDR pREL_ERR FSLIT("undefined")
412 crossDataCon_RDR = dataQual_RDR pREL_BASE FSLIT(":*:")
413 inlDataCon_RDR = dataQual_RDR pREL_BASE FSLIT("Inl")
414 inrDataCon_RDR = dataQual_RDR pREL_BASE FSLIT("Inr")
415 genUnitDataCon_RDR = dataQual_RDR pREL_BASE FSLIT("Unit")
417 ----------------------
418 varQual_RDR mod str = mkOrig mod (mkOccNameFS varName str)
419 tcQual_RDR mod str = mkOrig mod (mkOccNameFS tcName str)
420 clsQual_RDR mod str = mkOrig mod (mkOccNameFS clsName str)
421 dataQual_RDR mod str = mkOrig mod (mkOccNameFS dataName str)
424 %************************************************************************
426 \subsection{Known-key names}
428 %************************************************************************
430 Many of these Names are not really "built in", but some parts of the
431 compiler (notably the deriving mechanism) need to mention their names,
432 and it's convenient to write them all down in one place.
434 --MetaHaskell Extension add the constrs and the lower case case
435 -- guys as well (perhaps) e.g. see trueDataConName below
439 runMainIOName = varQual pREL_TOP_HANDLER FSLIT("runMainIO") runMainKey
441 orderingTyConName = tcQual pREL_BASE FSLIT("Ordering") orderingTyConKey
443 eitherTyConName = tcQual pREL_EITHER FSLIT("Either") eitherTyConKey
444 leftDataConName = conName eitherTyConName FSLIT("Left") leftDataConKey
445 rightDataConName = conName eitherTyConName FSLIT("Right") rightDataConKey
448 crossTyConName = tcQual pREL_BASE FSLIT(":*:") crossTyConKey
449 plusTyConName = tcQual pREL_BASE FSLIT(":+:") plusTyConKey
450 genUnitTyConName = tcQual pREL_BASE FSLIT("Unit") genUnitTyConKey
452 -- Base strings Strings
453 unpackCStringName = varQual pREL_BASE FSLIT("unpackCString#") unpackCStringIdKey
454 unpackCStringAppendName = varQual pREL_BASE FSLIT("unpackAppendCString#") unpackCStringAppendIdKey
455 unpackCStringFoldrName = varQual pREL_BASE FSLIT("unpackFoldrCString#") unpackCStringFoldrIdKey
456 unpackCStringUtf8Name = varQual pREL_BASE FSLIT("unpackCStringUtf8#") unpackCStringUtf8IdKey
457 eqStringName = varQual pREL_BASE FSLIT("eqString") eqStringIdKey
459 -- Base classes (Eq, Ord, Functor)
460 eqClassName = clsQual pREL_BASE FSLIT("Eq") eqClassKey
461 eqName = methName eqClassName FSLIT("==") eqClassOpKey
462 ordClassName = clsQual pREL_BASE FSLIT("Ord") ordClassKey
463 geName = methName ordClassName FSLIT(">=") geClassOpKey
464 functorClassName = clsQual pREL_BASE FSLIT("Functor") functorClassKey
467 monadClassName = clsQual pREL_BASE FSLIT("Monad") monadClassKey
468 thenMName = methName monadClassName FSLIT(">>") thenMClassOpKey
469 bindMName = methName monadClassName FSLIT(">>=") bindMClassOpKey
470 returnMName = methName monadClassName FSLIT("return") returnMClassOpKey
471 failMName = methName monadClassName FSLIT("fail") failMClassOpKey
473 -- Random PrelBase functions
474 otherwiseIdName = varQual pREL_BASE FSLIT("otherwise") otherwiseIdKey
475 foldrName = varQual pREL_BASE FSLIT("foldr") foldrIdKey
476 buildName = varQual pREL_BASE FSLIT("build") buildIdKey
477 augmentName = varQual pREL_BASE FSLIT("augment") augmentIdKey
478 appendName = varQual pREL_BASE FSLIT("++") appendIdKey
479 andName = varQual pREL_BASE FSLIT("&&") andIdKey
480 orName = varQual pREL_BASE FSLIT("||") orIdKey
481 assertName = varQual pREL_BASE FSLIT("assert") assertIdKey
482 breakpointName = varQual pREL_BASE FSLIT("breakpoint") breakpointIdKey
486 (mkOccNameFS varName FSLIT("breakpointJump"))
490 fstName = varQual pREL_TUP FSLIT("fst") fstIdKey
491 sndName = varQual pREL_TUP FSLIT("snd") sndIdKey
494 numClassName = clsQual pREL_NUM FSLIT("Num") numClassKey
495 fromIntegerName = methName numClassName FSLIT("fromInteger") fromIntegerClassOpKey
496 minusName = methName numClassName FSLIT("-") minusClassOpKey
497 negateName = methName numClassName FSLIT("negate") negateClassOpKey
498 plusIntegerName = varQual pREL_NUM FSLIT("plusInteger") plusIntegerIdKey
499 timesIntegerName = varQual pREL_NUM FSLIT("timesInteger") timesIntegerIdKey
500 integerTyConName = tcQual pREL_NUM FSLIT("Integer") integerTyConKey
501 smallIntegerDataConName = conName integerTyConName FSLIT("S#") smallIntegerDataConKey
502 largeIntegerDataConName = conName integerTyConName FSLIT("J#") largeIntegerDataConKey
504 -- PrelReal types and classes
505 rationalTyConName = tcQual pREL_REAL FSLIT("Rational") rationalTyConKey
506 ratioTyConName = tcQual pREL_REAL FSLIT("Ratio") ratioTyConKey
507 ratioDataConName = conName ratioTyConName FSLIT(":%") ratioDataConKey
508 realClassName = clsQual pREL_REAL FSLIT("Real") realClassKey
509 integralClassName = clsQual pREL_REAL FSLIT("Integral") integralClassKey
510 realFracClassName = clsQual pREL_REAL FSLIT("RealFrac") realFracClassKey
511 fractionalClassName = clsQual pREL_REAL FSLIT("Fractional") fractionalClassKey
512 fromRationalName = methName fractionalClassName FSLIT("fromRational") fromRationalClassOpKey
515 floatingClassName = clsQual pREL_FLOAT FSLIT("Floating") floatingClassKey
516 realFloatClassName = clsQual pREL_FLOAT FSLIT("RealFloat") realFloatClassKey
519 ixClassName = clsQual pREL_ARR FSLIT("Ix") ixClassKey
522 typeableClassName = clsQual tYPEABLE FSLIT("Typeable") typeableClassKey
523 typeable1ClassName = clsQual tYPEABLE FSLIT("Typeable1") typeable1ClassKey
524 typeable2ClassName = clsQual tYPEABLE FSLIT("Typeable2") typeable2ClassKey
525 typeable3ClassName = clsQual tYPEABLE FSLIT("Typeable3") typeable3ClassKey
526 typeable4ClassName = clsQual tYPEABLE FSLIT("Typeable4") typeable4ClassKey
527 typeable5ClassName = clsQual tYPEABLE FSLIT("Typeable5") typeable5ClassKey
528 typeable6ClassName = clsQual tYPEABLE FSLIT("Typeable6") typeable6ClassKey
529 typeable7ClassName = clsQual tYPEABLE FSLIT("Typeable7") typeable7ClassKey
531 typeableClassNames = [ typeableClassName, typeable1ClassName, typeable2ClassName
532 , typeable3ClassName, typeable4ClassName, typeable5ClassName
533 , typeable6ClassName, typeable7ClassName ]
536 dataClassName = clsQual gENERICS FSLIT("Data") dataClassKey
539 assertErrorName = varQual pREL_ERR FSLIT("assertError") assertErrorIdKey
541 -- Enum module (Enum, Bounded)
542 enumClassName = clsQual pREL_ENUM FSLIT("Enum") enumClassKey
543 enumFromName = methName enumClassName FSLIT("enumFrom") enumFromClassOpKey
544 enumFromToName = methName enumClassName FSLIT("enumFromTo") enumFromToClassOpKey
545 enumFromThenName = methName enumClassName FSLIT("enumFromThen") enumFromThenClassOpKey
546 enumFromThenToName = methName enumClassName FSLIT("enumFromThenTo") enumFromThenToClassOpKey
547 boundedClassName = clsQual pREL_ENUM FSLIT("Bounded") boundedClassKey
550 concatName = varQual pREL_LIST FSLIT("concat") concatIdKey
551 filterName = varQual pREL_LIST FSLIT("filter") filterIdKey
552 zipName = varQual pREL_LIST FSLIT("zip") zipIdKey
555 showClassName = clsQual pREL_SHOW FSLIT("Show") showClassKey
558 readClassName = clsQual pREL_READ FSLIT("Read") readClassKey
560 -- parallel array types and functions
561 enumFromToPName = varQual pREL_PARR FSLIT("enumFromToP") enumFromToPIdKey
562 enumFromThenToPName= varQual pREL_PARR FSLIT("enumFromThenToP") enumFromThenToPIdKey
563 nullPName = varQual pREL_PARR FSLIT("nullP") nullPIdKey
564 lengthPName = varQual pREL_PARR FSLIT("lengthP") lengthPIdKey
565 replicatePName = varQual pREL_PARR FSLIT("replicateP") replicatePIdKey
566 mapPName = varQual pREL_PARR FSLIT("mapP") mapPIdKey
567 filterPName = varQual pREL_PARR FSLIT("filterP") filterPIdKey
568 zipPName = varQual pREL_PARR FSLIT("zipP") zipPIdKey
569 crossPName = varQual pREL_PARR FSLIT("crossP") crossPIdKey
570 indexPName = varQual pREL_PARR FSLIT("!:") indexPIdKey
571 toPName = varQual pREL_PARR FSLIT("toP") toPIdKey
572 bpermutePName = varQual pREL_PARR FSLIT("bpermuteP") bpermutePIdKey
573 bpermuteDftPName = varQual pREL_PARR FSLIT("bpermuteDftP") bpermuteDftPIdKey
574 indexOfPName = varQual pREL_PARR FSLIT("indexOfP") indexOfPIdKey
577 ioTyConName = tcQual pREL_IO_BASE FSLIT("IO") ioTyConKey
578 ioDataConName = conName ioTyConName FSLIT("IO") ioDataConKey
579 thenIOName = varQual pREL_IO_BASE FSLIT("thenIO") thenIOIdKey
580 bindIOName = varQual pREL_IO_BASE FSLIT("bindIO") bindIOIdKey
581 returnIOName = varQual pREL_IO_BASE FSLIT("returnIO") returnIOIdKey
582 failIOName = varQual pREL_IO_BASE FSLIT("failIO") failIOIdKey
585 printName = varQual sYSTEM_IO FSLIT("print") printIdKey
587 -- Int, Word, and Addr things
588 int8TyConName = tcQual pREL_INT FSLIT("Int8") int8TyConKey
589 int16TyConName = tcQual pREL_INT FSLIT("Int16") int16TyConKey
590 int32TyConName = tcQual pREL_INT FSLIT("Int32") int32TyConKey
591 int64TyConName = tcQual pREL_INT FSLIT("Int64") int64TyConKey
594 word8TyConName = tcQual pREL_WORD FSLIT("Word8") word8TyConKey
595 word16TyConName = tcQual pREL_WORD FSLIT("Word16") word16TyConKey
596 word32TyConName = tcQual pREL_WORD FSLIT("Word32") word32TyConKey
597 word64TyConName = tcQual pREL_WORD FSLIT("Word64") word64TyConKey
598 wordTyConName = tcQual pREL_WORD FSLIT("Word") wordTyConKey
599 wordDataConName = conName wordTyConName FSLIT("W#") wordDataConKey
602 addrTyConName = tcQual aDDR FSLIT("Addr") addrTyConKey
605 ptrTyConName = tcQual pREL_PTR FSLIT("Ptr") ptrTyConKey
606 funPtrTyConName = tcQual pREL_PTR FSLIT("FunPtr") funPtrTyConKey
609 byteArrayTyConName = tcQual pREL_BYTEARR FSLIT("ByteArray") byteArrayTyConKey
610 mutableByteArrayTyConName = tcQual pREL_BYTEARR FSLIT("MutableByteArray") mutableByteArrayTyConKey
612 -- Foreign objects and weak pointers
613 stablePtrTyConName = tcQual pREL_STABLE FSLIT("StablePtr") stablePtrTyConKey
614 newStablePtrName = varQual pREL_STABLE FSLIT("newStablePtr") newStablePtrIdKey
617 runSTRepName = varQual pREL_ST FSLIT("runSTRep") runSTRepIdKey
619 -- The "split" Id for splittable implicit parameters
620 splittableClassName = clsQual gLA_EXTS FSLIT("Splittable") splittableClassKey
621 splitName = methName splittableClassName FSLIT("split") splitIdKey
623 -- Recursive-do notation
624 monadFixClassName = clsQual mONAD_FIX FSLIT("MonadFix") monadFixClassKey
625 mfixName = methName monadFixClassName FSLIT("mfix") mfixIdKey
628 arrAName = varQual aRROW FSLIT("arr") arrAIdKey
629 composeAName = varQual aRROW FSLIT(">>>") composeAIdKey
630 firstAName = varQual aRROW FSLIT("first") firstAIdKey
631 appAName = varQual aRROW FSLIT("app") appAIdKey
632 choiceAName = varQual aRROW FSLIT("|||") choiceAIdKey
633 loopAName = varQual aRROW FSLIT("loop") loopAIdKey
635 -- Other classes, needed for type defaulting
636 monadPlusClassName = clsQual mONAD FSLIT("MonadPlus") monadPlusClassKey
637 randomClassName = clsQual rANDOM FSLIT("Random") randomClassKey
638 randomGenClassName = clsQual rANDOM FSLIT("RandomGen") randomGenClassKey
641 objectTyConName = tcQual dOTNET FSLIT("Object") objectTyConKey
642 -- objectTyConName was "wTcQual", but that's gone now, and
643 -- I can't see why it was wired in anyway...
644 unmarshalObjectName = varQual dOTNET FSLIT("unmarshalObject") unmarshalObjectIdKey
645 marshalObjectName = varQual dOTNET FSLIT("marshalObject") marshalObjectIdKey
646 marshalStringName = varQual dOTNET FSLIT("marshalString") marshalStringIdKey
647 unmarshalStringName = varQual dOTNET FSLIT("unmarshalString") unmarshalStringIdKey
648 checkDotnetResName = varQual dOTNET FSLIT("checkResult") checkDotnetResNameIdKey
651 %************************************************************************
653 \subsection{Local helpers}
655 %************************************************************************
657 All these are original names; hence mkOrig
660 varQual = mk_known_key_name varName
661 tcQual = mk_known_key_name tcName
662 clsQual = mk_known_key_name clsName
664 mk_known_key_name space mod str uniq
665 = mkExternalName uniq mod (mkOccNameFS space str)
668 conName :: Name -> FastString -> Unique -> Name
669 conName tycon occ uniq
670 = mkExternalName uniq (nameModule tycon) (mkOccNameFS dataName occ)
671 (Just tycon) noSrcLoc
673 methName :: Name -> FastString -> Unique -> Name
674 methName cls occ uniq
675 = mkExternalName uniq (nameModule cls) (mkVarOccFS occ)
679 %************************************************************************
681 \subsubsection[Uniques-prelude-Classes]{@Uniques@ for wired-in @Classes@}
683 %************************************************************************
684 --MetaHaskell extension hand allocate keys here
687 boundedClassKey = mkPreludeClassUnique 1
688 enumClassKey = mkPreludeClassUnique 2
689 eqClassKey = mkPreludeClassUnique 3
690 floatingClassKey = mkPreludeClassUnique 5
691 fractionalClassKey = mkPreludeClassUnique 6
692 integralClassKey = mkPreludeClassUnique 7
693 monadClassKey = mkPreludeClassUnique 8
694 dataClassKey = mkPreludeClassUnique 9
695 functorClassKey = mkPreludeClassUnique 10
696 numClassKey = mkPreludeClassUnique 11
697 ordClassKey = mkPreludeClassUnique 12
698 readClassKey = mkPreludeClassUnique 13
699 realClassKey = mkPreludeClassUnique 14
700 realFloatClassKey = mkPreludeClassUnique 15
701 realFracClassKey = mkPreludeClassUnique 16
702 showClassKey = mkPreludeClassUnique 17
703 ixClassKey = mkPreludeClassUnique 18
705 typeableClassKey = mkPreludeClassUnique 20
706 typeable1ClassKey = mkPreludeClassUnique 21
707 typeable2ClassKey = mkPreludeClassUnique 22
708 typeable3ClassKey = mkPreludeClassUnique 23
709 typeable4ClassKey = mkPreludeClassUnique 24
710 typeable5ClassKey = mkPreludeClassUnique 25
711 typeable6ClassKey = mkPreludeClassUnique 26
712 typeable7ClassKey = mkPreludeClassUnique 27
714 monadFixClassKey = mkPreludeClassUnique 28
715 splittableClassKey = mkPreludeClassUnique 29
717 monadPlusClassKey = mkPreludeClassUnique 30
718 randomClassKey = mkPreludeClassUnique 31
719 randomGenClassKey = mkPreludeClassUnique 32
722 %************************************************************************
724 \subsubsection[Uniques-prelude-TyCons]{@Uniques@ for wired-in @TyCons@}
726 %************************************************************************
729 addrPrimTyConKey = mkPreludeTyConUnique 1
730 addrTyConKey = mkPreludeTyConUnique 2
731 arrayPrimTyConKey = mkPreludeTyConUnique 3
732 boolTyConKey = mkPreludeTyConUnique 4
733 byteArrayPrimTyConKey = mkPreludeTyConUnique 5
734 charPrimTyConKey = mkPreludeTyConUnique 7
735 charTyConKey = mkPreludeTyConUnique 8
736 doublePrimTyConKey = mkPreludeTyConUnique 9
737 doubleTyConKey = mkPreludeTyConUnique 10
738 floatPrimTyConKey = mkPreludeTyConUnique 11
739 floatTyConKey = mkPreludeTyConUnique 12
740 funTyConKey = mkPreludeTyConUnique 13
741 intPrimTyConKey = mkPreludeTyConUnique 14
742 intTyConKey = mkPreludeTyConUnique 15
743 int8TyConKey = mkPreludeTyConUnique 16
744 int16TyConKey = mkPreludeTyConUnique 17
745 int32PrimTyConKey = mkPreludeTyConUnique 18
746 int32TyConKey = mkPreludeTyConUnique 19
747 int64PrimTyConKey = mkPreludeTyConUnique 20
748 int64TyConKey = mkPreludeTyConUnique 21
749 integerTyConKey = mkPreludeTyConUnique 22
750 listTyConKey = mkPreludeTyConUnique 23
751 foreignObjPrimTyConKey = mkPreludeTyConUnique 24
752 weakPrimTyConKey = mkPreludeTyConUnique 27
753 mutableArrayPrimTyConKey = mkPreludeTyConUnique 28
754 mutableByteArrayPrimTyConKey = mkPreludeTyConUnique 29
755 orderingTyConKey = mkPreludeTyConUnique 30
756 mVarPrimTyConKey = mkPreludeTyConUnique 31
757 ratioTyConKey = mkPreludeTyConUnique 32
758 rationalTyConKey = mkPreludeTyConUnique 33
759 realWorldTyConKey = mkPreludeTyConUnique 34
760 stablePtrPrimTyConKey = mkPreludeTyConUnique 35
761 stablePtrTyConKey = mkPreludeTyConUnique 36
762 statePrimTyConKey = mkPreludeTyConUnique 50
763 stableNamePrimTyConKey = mkPreludeTyConUnique 51
764 stableNameTyConKey = mkPreludeTyConUnique 52
765 mutableByteArrayTyConKey = mkPreludeTyConUnique 53
766 mutVarPrimTyConKey = mkPreludeTyConUnique 55
767 ioTyConKey = mkPreludeTyConUnique 56
768 byteArrayTyConKey = mkPreludeTyConUnique 57
769 wordPrimTyConKey = mkPreludeTyConUnique 58
770 wordTyConKey = mkPreludeTyConUnique 59
771 word8TyConKey = mkPreludeTyConUnique 60
772 word16TyConKey = mkPreludeTyConUnique 61
773 word32PrimTyConKey = mkPreludeTyConUnique 62
774 word32TyConKey = mkPreludeTyConUnique 63
775 word64PrimTyConKey = mkPreludeTyConUnique 64
776 word64TyConKey = mkPreludeTyConUnique 65
777 liftedConKey = mkPreludeTyConUnique 66
778 unliftedConKey = mkPreludeTyConUnique 67
779 anyBoxConKey = mkPreludeTyConUnique 68
780 kindConKey = mkPreludeTyConUnique 69
781 boxityConKey = mkPreludeTyConUnique 70
782 typeConKey = mkPreludeTyConUnique 71
783 threadIdPrimTyConKey = mkPreludeTyConUnique 72
784 bcoPrimTyConKey = mkPreludeTyConUnique 73
785 ptrTyConKey = mkPreludeTyConUnique 74
786 funPtrTyConKey = mkPreludeTyConUnique 75
787 tVarPrimTyConKey = mkPreludeTyConUnique 76
789 -- Generic Type Constructors
790 crossTyConKey = mkPreludeTyConUnique 79
791 plusTyConKey = mkPreludeTyConUnique 80
792 genUnitTyConKey = mkPreludeTyConUnique 81
794 -- Parallel array type constructor
795 parrTyConKey = mkPreludeTyConUnique 82
798 objectTyConKey = mkPreludeTyConUnique 83
800 eitherTyConKey = mkPreludeTyConUnique 84
802 ---------------- Template Haskell -------------------
803 -- USES TyConUniques 100-129
804 -----------------------------------------------------
806 unitTyConKey = mkTupleTyConUnique Boxed 0
809 %************************************************************************
811 \subsubsection[Uniques-prelude-DataCons]{@Uniques@ for wired-in @DataCons@}
813 %************************************************************************
816 charDataConKey = mkPreludeDataConUnique 1
817 consDataConKey = mkPreludeDataConUnique 2
818 doubleDataConKey = mkPreludeDataConUnique 3
819 falseDataConKey = mkPreludeDataConUnique 4
820 floatDataConKey = mkPreludeDataConUnique 5
821 intDataConKey = mkPreludeDataConUnique 6
822 smallIntegerDataConKey = mkPreludeDataConUnique 7
823 largeIntegerDataConKey = mkPreludeDataConUnique 8
824 nilDataConKey = mkPreludeDataConUnique 11
825 ratioDataConKey = mkPreludeDataConUnique 12
826 stableNameDataConKey = mkPreludeDataConUnique 14
827 trueDataConKey = mkPreludeDataConUnique 15
828 wordDataConKey = mkPreludeDataConUnique 16
829 ioDataConKey = mkPreludeDataConUnique 17
831 -- Generic data constructors
832 crossDataConKey = mkPreludeDataConUnique 20
833 inlDataConKey = mkPreludeDataConUnique 21
834 inrDataConKey = mkPreludeDataConUnique 22
835 genUnitDataConKey = mkPreludeDataConUnique 23
837 -- Data constructor for parallel arrays
838 parrDataConKey = mkPreludeDataConUnique 24
840 leftDataConKey = mkPreludeDataConUnique 25
841 rightDataConKey = mkPreludeDataConUnique 26
844 %************************************************************************
846 \subsubsection[Uniques-prelude-Ids]{@Uniques@ for wired-in @Ids@ (except @DataCons@)}
848 %************************************************************************
851 absentErrorIdKey = mkPreludeMiscIdUnique 1
852 augmentIdKey = mkPreludeMiscIdUnique 3
853 appendIdKey = mkPreludeMiscIdUnique 4
854 buildIdKey = mkPreludeMiscIdUnique 5
855 errorIdKey = mkPreludeMiscIdUnique 6
856 foldlIdKey = mkPreludeMiscIdUnique 7
857 foldrIdKey = mkPreludeMiscIdUnique 8
858 recSelErrorIdKey = mkPreludeMiscIdUnique 9
859 integerMinusOneIdKey = mkPreludeMiscIdUnique 10
860 integerPlusOneIdKey = mkPreludeMiscIdUnique 11
861 integerPlusTwoIdKey = mkPreludeMiscIdUnique 12
862 integerZeroIdKey = mkPreludeMiscIdUnique 13
863 int2IntegerIdKey = mkPreludeMiscIdUnique 14
864 seqIdKey = mkPreludeMiscIdUnique 15
865 irrefutPatErrorIdKey = mkPreludeMiscIdUnique 16
866 eqStringIdKey = mkPreludeMiscIdUnique 17
867 noMethodBindingErrorIdKey = mkPreludeMiscIdUnique 18
868 nonExhaustiveGuardsErrorIdKey = mkPreludeMiscIdUnique 19
869 runtimeErrorIdKey = mkPreludeMiscIdUnique 20
870 parErrorIdKey = mkPreludeMiscIdUnique 21
871 parIdKey = mkPreludeMiscIdUnique 22
872 patErrorIdKey = mkPreludeMiscIdUnique 23
873 realWorldPrimIdKey = mkPreludeMiscIdUnique 24
874 recConErrorIdKey = mkPreludeMiscIdUnique 25
875 recUpdErrorIdKey = mkPreludeMiscIdUnique 26
876 traceIdKey = mkPreludeMiscIdUnique 27
877 unpackCStringUtf8IdKey = mkPreludeMiscIdUnique 28
878 unpackCStringAppendIdKey = mkPreludeMiscIdUnique 29
879 unpackCStringFoldrIdKey = mkPreludeMiscIdUnique 30
880 unpackCStringIdKey = mkPreludeMiscIdUnique 31
882 unsafeCoerceIdKey = mkPreludeMiscIdUnique 32
883 concatIdKey = mkPreludeMiscIdUnique 33
884 filterIdKey = mkPreludeMiscIdUnique 34
885 zipIdKey = mkPreludeMiscIdUnique 35
886 bindIOIdKey = mkPreludeMiscIdUnique 36
887 returnIOIdKey = mkPreludeMiscIdUnique 37
888 deRefStablePtrIdKey = mkPreludeMiscIdUnique 38
889 newStablePtrIdKey = mkPreludeMiscIdUnique 39
890 plusIntegerIdKey = mkPreludeMiscIdUnique 41
891 timesIntegerIdKey = mkPreludeMiscIdUnique 42
892 printIdKey = mkPreludeMiscIdUnique 43
893 failIOIdKey = mkPreludeMiscIdUnique 44
894 nullAddrIdKey = mkPreludeMiscIdUnique 46
895 voidArgIdKey = mkPreludeMiscIdUnique 47
896 splitIdKey = mkPreludeMiscIdUnique 48
897 fstIdKey = mkPreludeMiscIdUnique 49
898 sndIdKey = mkPreludeMiscIdUnique 50
899 otherwiseIdKey = mkPreludeMiscIdUnique 51
900 assertIdKey = mkPreludeMiscIdUnique 53
901 runSTRepIdKey = mkPreludeMiscIdUnique 54
903 rootMainKey = mkPreludeMiscIdUnique 55
904 runMainKey = mkPreludeMiscIdUnique 56
906 andIdKey = mkPreludeMiscIdUnique 57
907 orIdKey = mkPreludeMiscIdUnique 58
908 thenIOIdKey = mkPreludeMiscIdUnique 59
909 lazyIdKey = mkPreludeMiscIdUnique 60
910 assertErrorIdKey = mkPreludeMiscIdUnique 61
912 breakpointIdKey = mkPreludeMiscIdUnique 62
913 breakpointJumpIdKey = mkPreludeMiscIdUnique 63
915 -- Parallel array functions
916 nullPIdKey = mkPreludeMiscIdUnique 80
917 lengthPIdKey = mkPreludeMiscIdUnique 81
918 replicatePIdKey = mkPreludeMiscIdUnique 82
919 mapPIdKey = mkPreludeMiscIdUnique 83
920 filterPIdKey = mkPreludeMiscIdUnique 84
921 zipPIdKey = mkPreludeMiscIdUnique 85
922 crossPIdKey = mkPreludeMiscIdUnique 86
923 indexPIdKey = mkPreludeMiscIdUnique 87
924 toPIdKey = mkPreludeMiscIdUnique 88
925 enumFromToPIdKey = mkPreludeMiscIdUnique 89
926 enumFromThenToPIdKey = mkPreludeMiscIdUnique 90
927 bpermutePIdKey = mkPreludeMiscIdUnique 91
928 bpermuteDftPIdKey = mkPreludeMiscIdUnique 92
929 indexOfPIdKey = mkPreludeMiscIdUnique 93
932 unmarshalObjectIdKey = mkPreludeMiscIdUnique 94
933 marshalObjectIdKey = mkPreludeMiscIdUnique 95
934 marshalStringIdKey = mkPreludeMiscIdUnique 96
935 unmarshalStringIdKey = mkPreludeMiscIdUnique 97
936 checkDotnetResNameIdKey = mkPreludeMiscIdUnique 98
940 Certain class operations from Prelude classes. They get their own
941 uniques so we can look them up easily when we want to conjure them up
942 during type checking.
945 -- Just a place holder for unbound variables produced by the renamer:
946 unboundKey = mkPreludeMiscIdUnique 101
948 fromIntegerClassOpKey = mkPreludeMiscIdUnique 102
949 minusClassOpKey = mkPreludeMiscIdUnique 103
950 fromRationalClassOpKey = mkPreludeMiscIdUnique 104
951 enumFromClassOpKey = mkPreludeMiscIdUnique 105
952 enumFromThenClassOpKey = mkPreludeMiscIdUnique 106
953 enumFromToClassOpKey = mkPreludeMiscIdUnique 107
954 enumFromThenToClassOpKey = mkPreludeMiscIdUnique 108
955 eqClassOpKey = mkPreludeMiscIdUnique 109
956 geClassOpKey = mkPreludeMiscIdUnique 110
957 negateClassOpKey = mkPreludeMiscIdUnique 111
958 failMClassOpKey = mkPreludeMiscIdUnique 112
959 bindMClassOpKey = mkPreludeMiscIdUnique 113 -- (>>=)
960 thenMClassOpKey = mkPreludeMiscIdUnique 114 -- (>>)
961 returnMClassOpKey = mkPreludeMiscIdUnique 117
963 -- Recursive do notation
964 mfixIdKey = mkPreludeMiscIdUnique 118
967 arrAIdKey = mkPreludeMiscIdUnique 119
968 composeAIdKey = mkPreludeMiscIdUnique 120 -- >>>
969 firstAIdKey = mkPreludeMiscIdUnique 121
970 appAIdKey = mkPreludeMiscIdUnique 122
971 choiceAIdKey = mkPreludeMiscIdUnique 123 -- |||
972 loopAIdKey = mkPreludeMiscIdUnique 124
974 ---------------- Template Haskell -------------------
975 -- USES IdUniques 200-399
976 -----------------------------------------------------
980 %************************************************************************
982 \subsection{Standard groups of types}
984 %************************************************************************
996 -- Renamer always imports these data decls replete with constructors
997 -- so that desugarer can always see their constructors. Ugh!
1002 , mutableByteArrayTyConKey
1016 %************************************************************************
1018 \subsection[Class-std-groups]{Standard groups of Prelude classes}
1020 %************************************************************************
1022 NOTE: @Eq@ and @Text@ do need to appear in @standardClasses@
1023 even though every numeric class has these two as a superclass,
1024 because the list of ambiguous dictionaries hasn't been simplified.
1032 ++ fractionalClassKeys
1034 fractionalClassKeys =
1035 [ fractionalClassKey
1041 -- the strictness analyser needs to know about numeric types
1042 -- (see SaAbsInt.lhs)
1043 needsDataDeclCtxtClassKeys = -- see comments in TcDeriv
1047 -- The "standard classes" are used in defaulting (Haskell 98 report 4.3.4),
1048 -- and are: "classes defined in the Prelude or a standard library"
1049 standardClassKeys = derivableClassKeys ++ numericClassKeys
1050 ++ [randomClassKey, randomGenClassKey,
1052 monadClassKey, monadPlusClassKey]
1055 @derivableClassKeys@ is also used in checking \tr{deriving} constructs
1060 = [ eqClassKey, ordClassKey, enumClassKey, ixClassKey,
1061 boundedClassKey, showClassKey, readClassKey ]