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,
113 integerTyConName, smallIntegerDataConName, largeIntegerDataConName,
115 -- Classes. *Must* include:
116 -- classes that are grabbed by key (e.g., eqClassKey)
117 -- classes in "Class.standardClassKeys" (quite a few)
118 eqClassName, -- mentioned, derivable
119 ordClassName, -- derivable
120 boundedClassName, -- derivable
121 numClassName, -- mentioned, numeric
122 enumClassName, -- derivable
125 realClassName, -- numeric
126 integralClassName, -- numeric
127 fractionalClassName, -- numeric
128 floatingClassName, -- numeric
129 realFracClassName, -- numeric
130 realFloatClassName, -- numeric
134 negateName, minusName,
135 fromRationalName, fromIntegerName,
139 enumFromName, enumFromThenName,
140 enumFromThenToName, enumFromToName,
141 enumFromToPName, enumFromThenToPName,
144 thenIOName, bindIOName, returnIOName, failIOName,
145 failMName, bindMName, thenMName, returnMName,
151 arrAName, composeAName, firstAName,
152 appAName, choiceAName, loopAName,
167 unpackCStringName, unpackCStringAppendName,
168 unpackCStringFoldrName, unpackCStringUtf8Name,
171 concatName, filterName,
172 zipName, foldrName, buildName, augmentName, appendName,
174 -- Parallel array operations
175 nullPName, lengthPName, replicatePName, mapPName,
176 filterPName, zipPName, crossPName, indexPName,
177 toPName, bpermutePName, bpermuteDftPName, indexOfPName,
179 -- FFI primitive types that are not wired-in.
180 stablePtrTyConName, ptrTyConName, funPtrTyConName, addrTyConName,
181 int8TyConName, int16TyConName, int32TyConName, int64TyConName,
182 wordTyConName, word8TyConName, word16TyConName, word32TyConName, word64TyConName,
186 plusIntegerName, timesIntegerName,
187 eqStringName, assertName, breakpointName, breakpointCondName,
188 assertErrorName, runSTRepName,
189 printName, fstName, sndName,
192 monadFixClassName, mfixName,
195 splittableClassName, splitName,
198 randomClassName, randomGenClassName, monadPlusClassName,
204 , eitherTyConName, leftDataConName, rightDataConName
207 , objectTyConName, marshalObjectName, unmarshalObjectName
208 , marshalStringName, unmarshalStringName, checkDotnetResName
211 genericTyConNames :: [Name]
212 genericTyConNames = [crossTyConName, plusTyConName, genUnitTyConName]
216 %************************************************************************
218 \subsection{Module names}
220 %************************************************************************
223 --MetaHaskell Extension Add a new module here
225 pRELUDE = mkModule "Prelude"
226 gHC_PRIM = mkModule "GHC.Prim" -- Primitive types and values
227 pREL_BASE = mkModule "GHC.Base"
228 pREL_ENUM = mkModule "GHC.Enum"
229 pREL_SHOW = mkModule "GHC.Show"
230 pREL_READ = mkModule "GHC.Read"
231 pREL_NUM = mkModule "GHC.Num"
232 pREL_LIST = mkModule "GHC.List"
233 pREL_PARR = mkModule "GHC.PArr"
234 pREL_TUP = mkModule "Data.Tuple"
235 pREL_EITHER = mkModule "Data.Either"
236 pREL_PACK = mkModule "GHC.Pack"
237 pREL_CONC = mkModule "GHC.Conc"
238 pREL_IO_BASE = mkModule "GHC.IOBase"
239 pREL_ST = mkModule "GHC.ST"
240 pREL_ARR = mkModule "GHC.Arr"
241 pREL_STABLE = mkModule "GHC.Stable"
242 pREL_ADDR = mkModule "GHC.Addr"
243 pREL_PTR = mkModule "GHC.Ptr"
244 pREL_ERR = mkModule "GHC.Err"
245 pREL_REAL = mkModule "GHC.Real"
246 pREL_FLOAT = mkModule "GHC.Float"
247 pREL_TOP_HANDLER= mkModule "GHC.TopHandler"
248 sYSTEM_IO = mkModule "System.IO"
249 dYNAMIC = mkModule "Data.Dynamic"
250 tYPEABLE = mkModule "Data.Typeable"
251 gENERICS = mkModule "Data.Generics.Basics"
252 dOTNET = mkModule "GHC.Dotnet"
254 rEAD_PREC = mkModule "Text.ParserCombinators.ReadPrec"
255 lEX = mkModule "Text.Read.Lex"
257 mAIN = mkModule "Main"
258 pREL_INT = mkModule "GHC.Int"
259 pREL_WORD = mkModule "GHC.Word"
260 mONAD = mkModule "Control.Monad"
261 mONAD_FIX = mkModule "Control.Monad.Fix"
262 aRROW = mkModule "Control.Arrow"
263 aDDR = mkModule "Addr"
264 rANDOM = mkModule "System.Random"
266 gLA_EXTS = mkModule "GHC.Exts"
267 rOOT_MAIN = mkModule ":Main" -- Root module for initialisation
268 -- The ':xxx' makes a module name that the user can never
269 -- use himself. The z-encoding for ':' is "ZC", so the z-encoded
270 -- module name still starts with a capital letter, which keeps
271 -- the z-encoded version consistent.
273 iNTERACTIVE = mkModule ":Interactive"
274 thFAKE = mkModule ":THFake"
277 %************************************************************************
279 \subsection{Constructing the names of tuples
281 %************************************************************************
284 mkTupleModule :: Boxity -> Arity -> Module
285 mkTupleModule Boxed 0 = pREL_BASE
286 mkTupleModule Boxed _ = pREL_TUP
287 mkTupleModule Unboxed _ = gHC_PRIM
291 %************************************************************************
295 %************************************************************************
298 main_RDR_Unqual = mkUnqual varName FSLIT("main")
299 -- We definitely don't want an Orig RdrName, because
300 -- main might, in principle, be imported into module Main
302 eq_RDR = nameRdrName eqName
303 ge_RDR = nameRdrName geName
304 ne_RDR = varQual_RDR pREL_BASE FSLIT("/=")
305 le_RDR = varQual_RDR pREL_BASE FSLIT("<=")
306 gt_RDR = varQual_RDR pREL_BASE FSLIT(">")
307 compare_RDR = varQual_RDR pREL_BASE FSLIT("compare")
308 ltTag_RDR = dataQual_RDR pREL_BASE FSLIT("LT")
309 eqTag_RDR = dataQual_RDR pREL_BASE FSLIT("EQ")
310 gtTag_RDR = dataQual_RDR pREL_BASE FSLIT("GT")
312 eqClass_RDR = nameRdrName eqClassName
313 numClass_RDR = nameRdrName numClassName
314 ordClass_RDR = nameRdrName ordClassName
315 enumClass_RDR = nameRdrName enumClassName
316 monadClass_RDR = nameRdrName monadClassName
318 map_RDR = varQual_RDR pREL_BASE FSLIT("map")
319 append_RDR = varQual_RDR pREL_BASE FSLIT("++")
321 foldr_RDR = nameRdrName foldrName
322 build_RDR = nameRdrName buildName
323 returnM_RDR = nameRdrName returnMName
324 bindM_RDR = nameRdrName bindMName
325 failM_RDR = nameRdrName failMName
327 and_RDR = nameRdrName andName
329 left_RDR = nameRdrName leftDataConName
330 right_RDR = nameRdrName rightDataConName
332 fromEnum_RDR = varQual_RDR pREL_ENUM FSLIT("fromEnum")
333 toEnum_RDR = varQual_RDR pREL_ENUM FSLIT("toEnum")
335 enumFrom_RDR = nameRdrName enumFromName
336 enumFromTo_RDR = nameRdrName enumFromToName
337 enumFromThen_RDR = nameRdrName enumFromThenName
338 enumFromThenTo_RDR = nameRdrName enumFromThenToName
340 ratioDataCon_RDR = nameRdrName ratioDataConName
341 plusInteger_RDR = nameRdrName plusIntegerName
342 timesInteger_RDR = nameRdrName timesIntegerName
344 ioDataCon_RDR = nameRdrName ioDataConName
346 eqString_RDR = nameRdrName eqStringName
347 unpackCString_RDR = nameRdrName unpackCStringName
348 unpackCStringFoldr_RDR = nameRdrName unpackCStringFoldrName
349 unpackCStringUtf8_RDR = nameRdrName unpackCStringUtf8Name
351 newStablePtr_RDR = nameRdrName newStablePtrName
352 addrDataCon_RDR = dataQual_RDR aDDR FSLIT("A#")
353 wordDataCon_RDR = dataQual_RDR pREL_WORD FSLIT("W#")
355 bindIO_RDR = nameRdrName bindIOName
356 returnIO_RDR = nameRdrName returnIOName
358 fromInteger_RDR = nameRdrName fromIntegerName
359 fromRational_RDR = nameRdrName fromRationalName
360 minus_RDR = nameRdrName minusName
361 times_RDR = varQual_RDR pREL_NUM FSLIT("*")
362 plus_RDR = varQual_RDR pREL_NUM FSLIT("+")
364 compose_RDR = varQual_RDR pREL_BASE FSLIT(".")
366 not_RDR = varQual_RDR pREL_BASE FSLIT("not")
367 getTag_RDR = varQual_RDR pREL_BASE FSLIT("getTag")
368 succ_RDR = varQual_RDR pREL_ENUM FSLIT("succ")
369 pred_RDR = varQual_RDR pREL_ENUM FSLIT("pred")
370 minBound_RDR = varQual_RDR pREL_ENUM FSLIT("minBound")
371 maxBound_RDR = varQual_RDR pREL_ENUM FSLIT("maxBound")
372 range_RDR = varQual_RDR pREL_ARR FSLIT("range")
373 inRange_RDR = varQual_RDR pREL_ARR FSLIT("inRange")
374 index_RDR = varQual_RDR pREL_ARR FSLIT("index")
375 unsafeIndex_RDR = varQual_RDR pREL_ARR FSLIT("unsafeIndex")
376 unsafeRangeSize_RDR = varQual_RDR pREL_ARR FSLIT("unsafeRangeSize")
378 readList_RDR = varQual_RDR pREL_READ FSLIT("readList")
379 readListDefault_RDR = varQual_RDR pREL_READ FSLIT("readListDefault")
380 readListPrec_RDR = varQual_RDR pREL_READ FSLIT("readListPrec")
381 readListPrecDefault_RDR = varQual_RDR pREL_READ FSLIT("readListPrecDefault")
382 readPrec_RDR = varQual_RDR pREL_READ FSLIT("readPrec")
383 parens_RDR = varQual_RDR pREL_READ FSLIT("parens")
384 choose_RDR = varQual_RDR pREL_READ FSLIT("choose")
385 lexP_RDR = varQual_RDR pREL_READ FSLIT("lexP")
387 punc_RDR = dataQual_RDR lEX FSLIT("Punc")
388 ident_RDR = dataQual_RDR lEX FSLIT("Ident")
389 symbol_RDR = dataQual_RDR lEX FSLIT("Symbol")
391 step_RDR = varQual_RDR rEAD_PREC FSLIT("step")
392 alt_RDR = varQual_RDR rEAD_PREC FSLIT("+++")
393 reset_RDR = varQual_RDR rEAD_PREC FSLIT("reset")
394 prec_RDR = varQual_RDR rEAD_PREC FSLIT("prec")
396 showList_RDR = varQual_RDR pREL_SHOW FSLIT("showList")
397 showList___RDR = varQual_RDR pREL_SHOW FSLIT("showList__")
398 showsPrec_RDR = varQual_RDR pREL_SHOW FSLIT("showsPrec")
399 showString_RDR = varQual_RDR pREL_SHOW FSLIT("showString")
400 showSpace_RDR = varQual_RDR pREL_SHOW FSLIT("showSpace")
401 showParen_RDR = varQual_RDR pREL_SHOW FSLIT("showParen")
403 typeOf_RDR = varQual_RDR tYPEABLE FSLIT("typeOf")
404 mkTypeRep_RDR = varQual_RDR tYPEABLE FSLIT("mkTyConApp")
405 mkTyConRep_RDR = varQual_RDR tYPEABLE FSLIT("mkTyCon")
407 undefined_RDR = varQual_RDR pREL_ERR FSLIT("undefined")
409 crossDataCon_RDR = dataQual_RDR pREL_BASE FSLIT(":*:")
410 inlDataCon_RDR = dataQual_RDR pREL_BASE FSLIT("Inl")
411 inrDataCon_RDR = dataQual_RDR pREL_BASE FSLIT("Inr")
412 genUnitDataCon_RDR = dataQual_RDR pREL_BASE FSLIT("Unit")
414 ----------------------
415 varQual_RDR mod str = mkOrig mod (mkOccNameFS varName str)
416 tcQual_RDR mod str = mkOrig mod (mkOccNameFS tcName str)
417 clsQual_RDR mod str = mkOrig mod (mkOccNameFS clsName str)
418 dataQual_RDR mod str = mkOrig mod (mkOccNameFS dataName str)
421 %************************************************************************
423 \subsection{Known-key names}
425 %************************************************************************
427 Many of these Names are not really "built in", but some parts of the
428 compiler (notably the deriving mechanism) need to mention their names,
429 and it's convenient to write them all down in one place.
431 --MetaHaskell Extension add the constrs and the lower case case
432 -- guys as well (perhaps) e.g. see trueDataConName below
436 runMainIOName = varQual pREL_TOP_HANDLER FSLIT("runMainIO") runMainKey
438 orderingTyConName = tcQual pREL_BASE FSLIT("Ordering") orderingTyConKey
440 eitherTyConName = tcQual pREL_EITHER FSLIT("Either") eitherTyConKey
441 leftDataConName = conName eitherTyConName FSLIT("Left") leftDataConKey
442 rightDataConName = conName eitherTyConName FSLIT("Right") rightDataConKey
445 crossTyConName = tcQual pREL_BASE FSLIT(":*:") crossTyConKey
446 plusTyConName = tcQual pREL_BASE FSLIT(":+:") plusTyConKey
447 genUnitTyConName = tcQual pREL_BASE FSLIT("Unit") genUnitTyConKey
449 -- Base strings Strings
450 unpackCStringName = varQual pREL_BASE FSLIT("unpackCString#") unpackCStringIdKey
451 unpackCStringAppendName = varQual pREL_BASE FSLIT("unpackAppendCString#") unpackCStringAppendIdKey
452 unpackCStringFoldrName = varQual pREL_BASE FSLIT("unpackFoldrCString#") unpackCStringFoldrIdKey
453 unpackCStringUtf8Name = varQual pREL_BASE FSLIT("unpackCStringUtf8#") unpackCStringUtf8IdKey
454 eqStringName = varQual pREL_BASE FSLIT("eqString") eqStringIdKey
456 -- Base classes (Eq, Ord, Functor)
457 eqClassName = clsQual pREL_BASE FSLIT("Eq") eqClassKey
458 eqName = methName eqClassName FSLIT("==") eqClassOpKey
459 ordClassName = clsQual pREL_BASE FSLIT("Ord") ordClassKey
460 geName = methName ordClassName FSLIT(">=") geClassOpKey
461 functorClassName = clsQual pREL_BASE FSLIT("Functor") functorClassKey
464 monadClassName = clsQual pREL_BASE FSLIT("Monad") monadClassKey
465 thenMName = methName monadClassName FSLIT(">>") thenMClassOpKey
466 bindMName = methName monadClassName FSLIT(">>=") bindMClassOpKey
467 returnMName = methName monadClassName FSLIT("return") returnMClassOpKey
468 failMName = methName monadClassName FSLIT("fail") failMClassOpKey
470 -- Random PrelBase functions
471 otherwiseIdName = varQual pREL_BASE FSLIT("otherwise") otherwiseIdKey
472 foldrName = varQual pREL_BASE FSLIT("foldr") foldrIdKey
473 buildName = varQual pREL_BASE FSLIT("build") buildIdKey
474 augmentName = varQual pREL_BASE FSLIT("augment") augmentIdKey
475 appendName = varQual pREL_BASE FSLIT("++") appendIdKey
476 andName = varQual pREL_BASE FSLIT("&&") andIdKey
477 orName = varQual pREL_BASE FSLIT("||") orIdKey
478 assertName = varQual pREL_BASE FSLIT("assert") assertIdKey
479 breakpointName = varQual pREL_BASE FSLIT("breakpoint") breakpointIdKey
480 breakpointCondName= varQual pREL_BASE FSLIT("breakpointCond") breakpointCondIdKey
484 (mkOccNameFS varName FSLIT("breakpointJump"))
486 breakpointCondJumpName
488 breakpointCondJumpIdKey
489 (mkOccNameFS varName FSLIT("breakpointCondJump"))
493 fstName = varQual pREL_TUP FSLIT("fst") fstIdKey
494 sndName = varQual pREL_TUP FSLIT("snd") sndIdKey
497 numClassName = clsQual pREL_NUM FSLIT("Num") numClassKey
498 fromIntegerName = methName numClassName FSLIT("fromInteger") fromIntegerClassOpKey
499 minusName = methName numClassName FSLIT("-") minusClassOpKey
500 negateName = methName numClassName FSLIT("negate") negateClassOpKey
501 plusIntegerName = varQual pREL_NUM FSLIT("plusInteger") plusIntegerIdKey
502 timesIntegerName = varQual pREL_NUM FSLIT("timesInteger") timesIntegerIdKey
503 integerTyConName = tcQual pREL_NUM FSLIT("Integer") integerTyConKey
504 smallIntegerDataConName = conName integerTyConName FSLIT("S#") smallIntegerDataConKey
505 largeIntegerDataConName = conName integerTyConName FSLIT("J#") largeIntegerDataConKey
507 -- PrelReal types and classes
508 rationalTyConName = tcQual pREL_REAL FSLIT("Rational") rationalTyConKey
509 ratioTyConName = tcQual pREL_REAL FSLIT("Ratio") ratioTyConKey
510 ratioDataConName = conName ratioTyConName FSLIT(":%") ratioDataConKey
511 realClassName = clsQual pREL_REAL FSLIT("Real") realClassKey
512 integralClassName = clsQual pREL_REAL FSLIT("Integral") integralClassKey
513 realFracClassName = clsQual pREL_REAL FSLIT("RealFrac") realFracClassKey
514 fractionalClassName = clsQual pREL_REAL FSLIT("Fractional") fractionalClassKey
515 fromRationalName = methName fractionalClassName FSLIT("fromRational") fromRationalClassOpKey
518 floatingClassName = clsQual pREL_FLOAT FSLIT("Floating") floatingClassKey
519 realFloatClassName = clsQual pREL_FLOAT FSLIT("RealFloat") realFloatClassKey
522 ixClassName = clsQual pREL_ARR FSLIT("Ix") ixClassKey
525 typeableClassName = clsQual tYPEABLE FSLIT("Typeable") typeableClassKey
526 typeable1ClassName = clsQual tYPEABLE FSLIT("Typeable1") typeable1ClassKey
527 typeable2ClassName = clsQual tYPEABLE FSLIT("Typeable2") typeable2ClassKey
528 typeable3ClassName = clsQual tYPEABLE FSLIT("Typeable3") typeable3ClassKey
529 typeable4ClassName = clsQual tYPEABLE FSLIT("Typeable4") typeable4ClassKey
530 typeable5ClassName = clsQual tYPEABLE FSLIT("Typeable5") typeable5ClassKey
531 typeable6ClassName = clsQual tYPEABLE FSLIT("Typeable6") typeable6ClassKey
532 typeable7ClassName = clsQual tYPEABLE FSLIT("Typeable7") typeable7ClassKey
534 typeableClassNames = [ typeableClassName, typeable1ClassName, typeable2ClassName
535 , typeable3ClassName, typeable4ClassName, typeable5ClassName
536 , typeable6ClassName, typeable7ClassName ]
539 dataClassName = clsQual gENERICS FSLIT("Data") dataClassKey
542 assertErrorName = varQual pREL_ERR FSLIT("assertError") assertErrorIdKey
544 -- Enum module (Enum, Bounded)
545 enumClassName = clsQual pREL_ENUM FSLIT("Enum") enumClassKey
546 enumFromName = methName enumClassName FSLIT("enumFrom") enumFromClassOpKey
547 enumFromToName = methName enumClassName FSLIT("enumFromTo") enumFromToClassOpKey
548 enumFromThenName = methName enumClassName FSLIT("enumFromThen") enumFromThenClassOpKey
549 enumFromThenToName = methName enumClassName FSLIT("enumFromThenTo") enumFromThenToClassOpKey
550 boundedClassName = clsQual pREL_ENUM FSLIT("Bounded") boundedClassKey
553 concatName = varQual pREL_LIST FSLIT("concat") concatIdKey
554 filterName = varQual pREL_LIST FSLIT("filter") filterIdKey
555 zipName = varQual pREL_LIST FSLIT("zip") zipIdKey
558 showClassName = clsQual pREL_SHOW FSLIT("Show") showClassKey
561 readClassName = clsQual pREL_READ FSLIT("Read") readClassKey
563 -- parallel array types and functions
564 enumFromToPName = varQual pREL_PARR FSLIT("enumFromToP") enumFromToPIdKey
565 enumFromThenToPName= varQual pREL_PARR FSLIT("enumFromThenToP") enumFromThenToPIdKey
566 nullPName = varQual pREL_PARR FSLIT("nullP") nullPIdKey
567 lengthPName = varQual pREL_PARR FSLIT("lengthP") lengthPIdKey
568 replicatePName = varQual pREL_PARR FSLIT("replicateP") replicatePIdKey
569 mapPName = varQual pREL_PARR FSLIT("mapP") mapPIdKey
570 filterPName = varQual pREL_PARR FSLIT("filterP") filterPIdKey
571 zipPName = varQual pREL_PARR FSLIT("zipP") zipPIdKey
572 crossPName = varQual pREL_PARR FSLIT("crossP") crossPIdKey
573 indexPName = varQual pREL_PARR FSLIT("!:") indexPIdKey
574 toPName = varQual pREL_PARR FSLIT("toP") toPIdKey
575 bpermutePName = varQual pREL_PARR FSLIT("bpermuteP") bpermutePIdKey
576 bpermuteDftPName = varQual pREL_PARR FSLIT("bpermuteDftP") bpermuteDftPIdKey
577 indexOfPName = varQual pREL_PARR FSLIT("indexOfP") indexOfPIdKey
580 ioTyConName = tcQual pREL_IO_BASE FSLIT("IO") ioTyConKey
581 ioDataConName = conName ioTyConName FSLIT("IO") ioDataConKey
582 thenIOName = varQual pREL_IO_BASE FSLIT("thenIO") thenIOIdKey
583 bindIOName = varQual pREL_IO_BASE FSLIT("bindIO") bindIOIdKey
584 returnIOName = varQual pREL_IO_BASE FSLIT("returnIO") returnIOIdKey
585 failIOName = varQual pREL_IO_BASE FSLIT("failIO") failIOIdKey
588 printName = varQual sYSTEM_IO FSLIT("print") printIdKey
590 -- Int, Word, and Addr things
591 int8TyConName = tcQual pREL_INT FSLIT("Int8") int8TyConKey
592 int16TyConName = tcQual pREL_INT FSLIT("Int16") int16TyConKey
593 int32TyConName = tcQual pREL_INT FSLIT("Int32") int32TyConKey
594 int64TyConName = tcQual pREL_INT FSLIT("Int64") int64TyConKey
597 word8TyConName = tcQual pREL_WORD FSLIT("Word8") word8TyConKey
598 word16TyConName = tcQual pREL_WORD FSLIT("Word16") word16TyConKey
599 word32TyConName = tcQual pREL_WORD FSLIT("Word32") word32TyConKey
600 word64TyConName = tcQual pREL_WORD FSLIT("Word64") word64TyConKey
601 wordTyConName = tcQual pREL_WORD FSLIT("Word") wordTyConKey
602 wordDataConName = conName wordTyConName FSLIT("W#") wordDataConKey
605 addrTyConName = tcQual aDDR FSLIT("Addr") addrTyConKey
608 ptrTyConName = tcQual pREL_PTR FSLIT("Ptr") ptrTyConKey
609 funPtrTyConName = tcQual pREL_PTR FSLIT("FunPtr") funPtrTyConKey
611 -- Foreign objects and weak pointers
612 stablePtrTyConName = tcQual pREL_STABLE FSLIT("StablePtr") stablePtrTyConKey
613 newStablePtrName = varQual pREL_STABLE FSLIT("newStablePtr") newStablePtrIdKey
616 runSTRepName = varQual pREL_ST FSLIT("runSTRep") runSTRepIdKey
618 -- The "split" Id for splittable implicit parameters
619 splittableClassName = clsQual gLA_EXTS FSLIT("Splittable") splittableClassKey
620 splitName = methName splittableClassName FSLIT("split") splitIdKey
622 -- Recursive-do notation
623 monadFixClassName = clsQual mONAD_FIX FSLIT("MonadFix") monadFixClassKey
624 mfixName = methName monadFixClassName FSLIT("mfix") mfixIdKey
627 arrAName = varQual aRROW FSLIT("arr") arrAIdKey
628 composeAName = varQual aRROW FSLIT(">>>") composeAIdKey
629 firstAName = varQual aRROW FSLIT("first") firstAIdKey
630 appAName = varQual aRROW FSLIT("app") appAIdKey
631 choiceAName = varQual aRROW FSLIT("|||") choiceAIdKey
632 loopAName = varQual aRROW FSLIT("loop") loopAIdKey
634 -- Other classes, needed for type defaulting
635 monadPlusClassName = clsQual mONAD FSLIT("MonadPlus") monadPlusClassKey
636 randomClassName = clsQual rANDOM FSLIT("Random") randomClassKey
637 randomGenClassName = clsQual rANDOM FSLIT("RandomGen") randomGenClassKey
640 objectTyConName = tcQual dOTNET FSLIT("Object") objectTyConKey
641 -- objectTyConName was "wTcQual", but that's gone now, and
642 -- I can't see why it was wired in anyway...
643 unmarshalObjectName = varQual dOTNET FSLIT("unmarshalObject") unmarshalObjectIdKey
644 marshalObjectName = varQual dOTNET FSLIT("marshalObject") marshalObjectIdKey
645 marshalStringName = varQual dOTNET FSLIT("marshalString") marshalStringIdKey
646 unmarshalStringName = varQual dOTNET FSLIT("unmarshalString") unmarshalStringIdKey
647 checkDotnetResName = varQual dOTNET FSLIT("checkResult") checkDotnetResNameIdKey
650 %************************************************************************
652 \subsection{Local helpers}
654 %************************************************************************
656 All these are original names; hence mkOrig
659 varQual = mk_known_key_name varName
660 tcQual = mk_known_key_name tcName
661 clsQual = mk_known_key_name clsName
663 mk_known_key_name space mod str uniq
664 = mkExternalName uniq mod (mkOccNameFS space str)
667 conName :: Name -> FastString -> Unique -> Name
668 conName tycon occ uniq
669 = mkExternalName uniq (nameModule tycon) (mkOccNameFS dataName occ)
670 (Just tycon) noSrcLoc
672 methName :: Name -> FastString -> Unique -> Name
673 methName cls occ uniq
674 = mkExternalName uniq (nameModule cls) (mkVarOccFS occ)
678 %************************************************************************
680 \subsubsection[Uniques-prelude-Classes]{@Uniques@ for wired-in @Classes@}
682 %************************************************************************
683 --MetaHaskell extension hand allocate keys here
686 boundedClassKey = mkPreludeClassUnique 1
687 enumClassKey = mkPreludeClassUnique 2
688 eqClassKey = mkPreludeClassUnique 3
689 floatingClassKey = mkPreludeClassUnique 5
690 fractionalClassKey = mkPreludeClassUnique 6
691 integralClassKey = mkPreludeClassUnique 7
692 monadClassKey = mkPreludeClassUnique 8
693 dataClassKey = mkPreludeClassUnique 9
694 functorClassKey = mkPreludeClassUnique 10
695 numClassKey = mkPreludeClassUnique 11
696 ordClassKey = mkPreludeClassUnique 12
697 readClassKey = mkPreludeClassUnique 13
698 realClassKey = mkPreludeClassUnique 14
699 realFloatClassKey = mkPreludeClassUnique 15
700 realFracClassKey = mkPreludeClassUnique 16
701 showClassKey = mkPreludeClassUnique 17
702 ixClassKey = mkPreludeClassUnique 18
704 typeableClassKey = mkPreludeClassUnique 20
705 typeable1ClassKey = mkPreludeClassUnique 21
706 typeable2ClassKey = mkPreludeClassUnique 22
707 typeable3ClassKey = mkPreludeClassUnique 23
708 typeable4ClassKey = mkPreludeClassUnique 24
709 typeable5ClassKey = mkPreludeClassUnique 25
710 typeable6ClassKey = mkPreludeClassUnique 26
711 typeable7ClassKey = mkPreludeClassUnique 27
713 monadFixClassKey = mkPreludeClassUnique 28
714 splittableClassKey = mkPreludeClassUnique 29
716 monadPlusClassKey = mkPreludeClassUnique 30
717 randomClassKey = mkPreludeClassUnique 31
718 randomGenClassKey = mkPreludeClassUnique 32
721 %************************************************************************
723 \subsubsection[Uniques-prelude-TyCons]{@Uniques@ for wired-in @TyCons@}
725 %************************************************************************
728 addrPrimTyConKey = mkPreludeTyConUnique 1
729 addrTyConKey = mkPreludeTyConUnique 2
730 arrayPrimTyConKey = mkPreludeTyConUnique 3
731 boolTyConKey = mkPreludeTyConUnique 4
732 byteArrayPrimTyConKey = mkPreludeTyConUnique 5
733 charPrimTyConKey = mkPreludeTyConUnique 7
734 charTyConKey = mkPreludeTyConUnique 8
735 doublePrimTyConKey = mkPreludeTyConUnique 9
736 doubleTyConKey = mkPreludeTyConUnique 10
737 floatPrimTyConKey = mkPreludeTyConUnique 11
738 floatTyConKey = mkPreludeTyConUnique 12
739 funTyConKey = mkPreludeTyConUnique 13
740 intPrimTyConKey = mkPreludeTyConUnique 14
741 intTyConKey = mkPreludeTyConUnique 15
742 int8TyConKey = mkPreludeTyConUnique 16
743 int16TyConKey = mkPreludeTyConUnique 17
744 int32PrimTyConKey = mkPreludeTyConUnique 18
745 int32TyConKey = mkPreludeTyConUnique 19
746 int64PrimTyConKey = mkPreludeTyConUnique 20
747 int64TyConKey = mkPreludeTyConUnique 21
748 integerTyConKey = mkPreludeTyConUnique 22
749 listTyConKey = mkPreludeTyConUnique 23
750 foreignObjPrimTyConKey = mkPreludeTyConUnique 24
751 weakPrimTyConKey = mkPreludeTyConUnique 27
752 mutableArrayPrimTyConKey = mkPreludeTyConUnique 28
753 mutableByteArrayPrimTyConKey = mkPreludeTyConUnique 29
754 orderingTyConKey = mkPreludeTyConUnique 30
755 mVarPrimTyConKey = mkPreludeTyConUnique 31
756 ratioTyConKey = mkPreludeTyConUnique 32
757 rationalTyConKey = mkPreludeTyConUnique 33
758 realWorldTyConKey = mkPreludeTyConUnique 34
759 stablePtrPrimTyConKey = mkPreludeTyConUnique 35
760 stablePtrTyConKey = mkPreludeTyConUnique 36
761 statePrimTyConKey = mkPreludeTyConUnique 50
762 stableNamePrimTyConKey = mkPreludeTyConUnique 51
763 stableNameTyConKey = mkPreludeTyConUnique 52
764 mutVarPrimTyConKey = mkPreludeTyConUnique 55
765 ioTyConKey = mkPreludeTyConUnique 56
766 wordPrimTyConKey = mkPreludeTyConUnique 58
767 wordTyConKey = mkPreludeTyConUnique 59
768 word8TyConKey = mkPreludeTyConUnique 60
769 word16TyConKey = mkPreludeTyConUnique 61
770 word32PrimTyConKey = mkPreludeTyConUnique 62
771 word32TyConKey = mkPreludeTyConUnique 63
772 word64PrimTyConKey = mkPreludeTyConUnique 64
773 word64TyConKey = mkPreludeTyConUnique 65
774 liftedConKey = mkPreludeTyConUnique 66
775 unliftedConKey = mkPreludeTyConUnique 67
776 anyBoxConKey = mkPreludeTyConUnique 68
777 kindConKey = mkPreludeTyConUnique 69
778 boxityConKey = mkPreludeTyConUnique 70
779 typeConKey = mkPreludeTyConUnique 71
780 threadIdPrimTyConKey = mkPreludeTyConUnique 72
781 bcoPrimTyConKey = mkPreludeTyConUnique 73
782 ptrTyConKey = mkPreludeTyConUnique 74
783 funPtrTyConKey = mkPreludeTyConUnique 75
784 tVarPrimTyConKey = mkPreludeTyConUnique 76
786 -- Generic Type Constructors
787 crossTyConKey = mkPreludeTyConUnique 79
788 plusTyConKey = mkPreludeTyConUnique 80
789 genUnitTyConKey = mkPreludeTyConUnique 81
791 -- Parallel array type constructor
792 parrTyConKey = mkPreludeTyConUnique 82
795 objectTyConKey = mkPreludeTyConUnique 83
797 eitherTyConKey = mkPreludeTyConUnique 84
799 ---------------- Template Haskell -------------------
800 -- USES TyConUniques 100-129
801 -----------------------------------------------------
803 unitTyConKey = mkTupleTyConUnique Boxed 0
806 %************************************************************************
808 \subsubsection[Uniques-prelude-DataCons]{@Uniques@ for wired-in @DataCons@}
810 %************************************************************************
813 charDataConKey = mkPreludeDataConUnique 1
814 consDataConKey = mkPreludeDataConUnique 2
815 doubleDataConKey = mkPreludeDataConUnique 3
816 falseDataConKey = mkPreludeDataConUnique 4
817 floatDataConKey = mkPreludeDataConUnique 5
818 intDataConKey = mkPreludeDataConUnique 6
819 smallIntegerDataConKey = mkPreludeDataConUnique 7
820 largeIntegerDataConKey = mkPreludeDataConUnique 8
821 nilDataConKey = mkPreludeDataConUnique 11
822 ratioDataConKey = mkPreludeDataConUnique 12
823 stableNameDataConKey = mkPreludeDataConUnique 14
824 trueDataConKey = mkPreludeDataConUnique 15
825 wordDataConKey = mkPreludeDataConUnique 16
826 ioDataConKey = mkPreludeDataConUnique 17
828 -- Generic data constructors
829 crossDataConKey = mkPreludeDataConUnique 20
830 inlDataConKey = mkPreludeDataConUnique 21
831 inrDataConKey = mkPreludeDataConUnique 22
832 genUnitDataConKey = mkPreludeDataConUnique 23
834 -- Data constructor for parallel arrays
835 parrDataConKey = mkPreludeDataConUnique 24
837 leftDataConKey = mkPreludeDataConUnique 25
838 rightDataConKey = mkPreludeDataConUnique 26
841 %************************************************************************
843 \subsubsection[Uniques-prelude-Ids]{@Uniques@ for wired-in @Ids@ (except @DataCons@)}
845 %************************************************************************
848 absentErrorIdKey = mkPreludeMiscIdUnique 1
849 augmentIdKey = mkPreludeMiscIdUnique 3
850 appendIdKey = mkPreludeMiscIdUnique 4
851 buildIdKey = mkPreludeMiscIdUnique 5
852 errorIdKey = mkPreludeMiscIdUnique 6
853 foldlIdKey = mkPreludeMiscIdUnique 7
854 foldrIdKey = mkPreludeMiscIdUnique 8
855 recSelErrorIdKey = mkPreludeMiscIdUnique 9
856 integerMinusOneIdKey = mkPreludeMiscIdUnique 10
857 integerPlusOneIdKey = mkPreludeMiscIdUnique 11
858 integerPlusTwoIdKey = mkPreludeMiscIdUnique 12
859 integerZeroIdKey = mkPreludeMiscIdUnique 13
860 int2IntegerIdKey = mkPreludeMiscIdUnique 14
861 seqIdKey = mkPreludeMiscIdUnique 15
862 irrefutPatErrorIdKey = mkPreludeMiscIdUnique 16
863 eqStringIdKey = mkPreludeMiscIdUnique 17
864 noMethodBindingErrorIdKey = mkPreludeMiscIdUnique 18
865 nonExhaustiveGuardsErrorIdKey = mkPreludeMiscIdUnique 19
866 runtimeErrorIdKey = mkPreludeMiscIdUnique 20
867 parErrorIdKey = mkPreludeMiscIdUnique 21
868 parIdKey = mkPreludeMiscIdUnique 22
869 patErrorIdKey = mkPreludeMiscIdUnique 23
870 realWorldPrimIdKey = mkPreludeMiscIdUnique 24
871 recConErrorIdKey = mkPreludeMiscIdUnique 25
872 recUpdErrorIdKey = mkPreludeMiscIdUnique 26
873 traceIdKey = mkPreludeMiscIdUnique 27
874 unpackCStringUtf8IdKey = mkPreludeMiscIdUnique 28
875 unpackCStringAppendIdKey = mkPreludeMiscIdUnique 29
876 unpackCStringFoldrIdKey = mkPreludeMiscIdUnique 30
877 unpackCStringIdKey = mkPreludeMiscIdUnique 31
879 unsafeCoerceIdKey = mkPreludeMiscIdUnique 32
880 concatIdKey = mkPreludeMiscIdUnique 33
881 filterIdKey = mkPreludeMiscIdUnique 34
882 zipIdKey = mkPreludeMiscIdUnique 35
883 bindIOIdKey = mkPreludeMiscIdUnique 36
884 returnIOIdKey = mkPreludeMiscIdUnique 37
885 deRefStablePtrIdKey = mkPreludeMiscIdUnique 38
886 newStablePtrIdKey = mkPreludeMiscIdUnique 39
887 plusIntegerIdKey = mkPreludeMiscIdUnique 41
888 timesIntegerIdKey = mkPreludeMiscIdUnique 42
889 printIdKey = mkPreludeMiscIdUnique 43
890 failIOIdKey = mkPreludeMiscIdUnique 44
891 nullAddrIdKey = mkPreludeMiscIdUnique 46
892 voidArgIdKey = mkPreludeMiscIdUnique 47
893 splitIdKey = mkPreludeMiscIdUnique 48
894 fstIdKey = mkPreludeMiscIdUnique 49
895 sndIdKey = mkPreludeMiscIdUnique 50
896 otherwiseIdKey = mkPreludeMiscIdUnique 51
897 assertIdKey = mkPreludeMiscIdUnique 53
898 runSTRepIdKey = mkPreludeMiscIdUnique 54
900 rootMainKey = mkPreludeMiscIdUnique 55
901 runMainKey = mkPreludeMiscIdUnique 56
903 andIdKey = mkPreludeMiscIdUnique 57
904 orIdKey = mkPreludeMiscIdUnique 58
905 thenIOIdKey = mkPreludeMiscIdUnique 59
906 lazyIdKey = mkPreludeMiscIdUnique 60
907 assertErrorIdKey = mkPreludeMiscIdUnique 61
909 breakpointIdKey = mkPreludeMiscIdUnique 62
910 breakpointCondIdKey = mkPreludeMiscIdUnique 63
911 breakpointJumpIdKey = mkPreludeMiscIdUnique 64
912 breakpointCondJumpIdKey = mkPreludeMiscIdUnique 65
914 -- Parallel array functions
915 nullPIdKey = mkPreludeMiscIdUnique 80
916 lengthPIdKey = mkPreludeMiscIdUnique 81
917 replicatePIdKey = mkPreludeMiscIdUnique 82
918 mapPIdKey = mkPreludeMiscIdUnique 83
919 filterPIdKey = mkPreludeMiscIdUnique 84
920 zipPIdKey = mkPreludeMiscIdUnique 85
921 crossPIdKey = mkPreludeMiscIdUnique 86
922 indexPIdKey = mkPreludeMiscIdUnique 87
923 toPIdKey = mkPreludeMiscIdUnique 88
924 enumFromToPIdKey = mkPreludeMiscIdUnique 89
925 enumFromThenToPIdKey = mkPreludeMiscIdUnique 90
926 bpermutePIdKey = mkPreludeMiscIdUnique 91
927 bpermuteDftPIdKey = mkPreludeMiscIdUnique 92
928 indexOfPIdKey = mkPreludeMiscIdUnique 93
931 unmarshalObjectIdKey = mkPreludeMiscIdUnique 94
932 marshalObjectIdKey = mkPreludeMiscIdUnique 95
933 marshalStringIdKey = mkPreludeMiscIdUnique 96
934 unmarshalStringIdKey = mkPreludeMiscIdUnique 97
935 checkDotnetResNameIdKey = mkPreludeMiscIdUnique 98
939 Certain class operations from Prelude classes. They get their own
940 uniques so we can look them up easily when we want to conjure them up
941 during type checking.
944 -- Just a place holder for unbound variables produced by the renamer:
945 unboundKey = mkPreludeMiscIdUnique 101
947 fromIntegerClassOpKey = mkPreludeMiscIdUnique 102
948 minusClassOpKey = mkPreludeMiscIdUnique 103
949 fromRationalClassOpKey = mkPreludeMiscIdUnique 104
950 enumFromClassOpKey = mkPreludeMiscIdUnique 105
951 enumFromThenClassOpKey = mkPreludeMiscIdUnique 106
952 enumFromToClassOpKey = mkPreludeMiscIdUnique 107
953 enumFromThenToClassOpKey = mkPreludeMiscIdUnique 108
954 eqClassOpKey = mkPreludeMiscIdUnique 109
955 geClassOpKey = mkPreludeMiscIdUnique 110
956 negateClassOpKey = mkPreludeMiscIdUnique 111
957 failMClassOpKey = mkPreludeMiscIdUnique 112
958 bindMClassOpKey = mkPreludeMiscIdUnique 113 -- (>>=)
959 thenMClassOpKey = mkPreludeMiscIdUnique 114 -- (>>)
960 returnMClassOpKey = mkPreludeMiscIdUnique 117
962 -- Recursive do notation
963 mfixIdKey = mkPreludeMiscIdUnique 118
966 arrAIdKey = mkPreludeMiscIdUnique 119
967 composeAIdKey = mkPreludeMiscIdUnique 120 -- >>>
968 firstAIdKey = mkPreludeMiscIdUnique 121
969 appAIdKey = mkPreludeMiscIdUnique 122
970 choiceAIdKey = mkPreludeMiscIdUnique 123 -- |||
971 loopAIdKey = mkPreludeMiscIdUnique 124
973 ---------------- Template Haskell -------------------
974 -- USES IdUniques 200-399
975 -----------------------------------------------------
979 %************************************************************************
981 \subsection{Standard groups of types}
983 %************************************************************************
995 -- Renamer always imports these data decls replete with constructors
996 -- so that desugarer can always see their constructors. Ugh!
1013 %************************************************************************
1015 \subsection[Class-std-groups]{Standard groups of Prelude classes}
1017 %************************************************************************
1019 NOTE: @Eq@ and @Text@ do need to appear in @standardClasses@
1020 even though every numeric class has these two as a superclass,
1021 because the list of ambiguous dictionaries hasn't been simplified.
1029 ++ fractionalClassKeys
1031 fractionalClassKeys =
1032 [ fractionalClassKey
1038 -- the strictness analyser needs to know about numeric types
1039 -- (see SaAbsInt.lhs)
1040 needsDataDeclCtxtClassKeys = -- see comments in TcDeriv
1044 -- The "standard classes" are used in defaulting (Haskell 98 report 4.3.4),
1045 -- and are: "classes defined in the Prelude or a standard library"
1046 standardClassKeys = derivableClassKeys ++ numericClassKeys
1047 ++ [randomClassKey, randomGenClassKey,
1049 monadClassKey, monadPlusClassKey]
1052 @derivableClassKeys@ is also used in checking \tr{deriving} constructs
1057 = [ eqClassKey, ordClassKey, enumClassKey, ixClassKey,
1058 boundedClassKey, showClassKey, readClassKey ]