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"
53 import Module ( Module, ModuleName, mkModule, mkModuleNameFS )
54 import OccName ( dataName, tcName, clsName, varName, mkOccNameFS,
56 import RdrName ( RdrName, nameRdrName, mkOrig, rdrNameOcc, mkUnqual )
57 import Unique ( Unique, Uniquable(..), hasKey,
58 mkPreludeMiscIdUnique, mkPreludeDataConUnique,
59 mkPreludeTyConUnique, mkPreludeClassUnique,
62 import BasicTypes ( Boxity(..), Arity )
63 import Name ( Name, mkInternalName, mkExternalName )
64 import SrcLoc ( noSrcLoc )
69 %************************************************************************
71 \subsection{Local Names}
73 %************************************************************************
75 This *local* name is used by the interactive stuff
78 itName uniq = mkInternalName uniq (mkOccNameFS varName FSLIT("it")) noSrcLoc
82 -- mkUnboundName makes a place-holder Name; it shouldn't be looked at except possibly
83 -- during compiler debugging.
84 mkUnboundName :: RdrName -> Name
85 mkUnboundName rdr_name = mkInternalName unboundKey (rdrNameOcc rdr_name) noSrcLoc
87 isUnboundName :: Name -> Bool
88 isUnboundName name = name `hasKey` unboundKey
92 %************************************************************************
94 \subsection{Known key Names}
96 %************************************************************************
98 This section tells what the compiler knows about the assocation of
99 names with uniques. These ones are the *non* wired-in ones. The
100 wired in ones are defined in TysWiredIn etc.
103 basicKnownKeyNames :: [Name]
106 ++ typeableClassNames
107 ++ [ -- Type constructors (synonyms especially)
108 ioTyConName, ioDataConName,
114 integerTyConName, smallIntegerDataConName, largeIntegerDataConName,
116 -- Classes. *Must* include:
117 -- classes that are grabbed by key (e.g., eqClassKey)
118 -- classes in "Class.standardClassKeys" (quite a few)
119 eqClassName, -- mentioned, derivable
120 ordClassName, -- derivable
121 boundedClassName, -- derivable
122 numClassName, -- mentioned, numeric
123 enumClassName, -- derivable
126 realClassName, -- numeric
127 integralClassName, -- numeric
128 fractionalClassName, -- numeric
129 floatingClassName, -- numeric
130 realFracClassName, -- numeric
131 realFloatClassName, -- numeric
135 negateName, minusName,
136 fromRationalName, fromIntegerName,
140 enumFromName, enumFromThenName,
141 enumFromThenToName, enumFromToName,
142 enumFromToPName, enumFromThenToPName,
145 thenIOName, bindIOName, returnIOName, failIOName,
146 failMName, bindMName, thenMName, returnMName,
152 arrAName, composeAName, firstAName,
153 appAName, choiceAName, loopAName,
168 unpackCStringName, unpackCStringAppendName,
169 unpackCStringFoldrName, unpackCStringUtf8Name,
172 concatName, filterName,
173 zipName, foldrName, buildName, augmentName, appendName,
175 -- Parallel array operations
176 nullPName, lengthPName, replicatePName, mapPName,
177 filterPName, zipPName, crossPName, indexPName,
178 toPName, bpermutePName, bpermuteDftPName, indexOfPName,
180 -- FFI primitive types that are not wired-in.
181 stablePtrTyConName, ptrTyConName, funPtrTyConName,
182 int8TyConName, int16TyConName, int32TyConName, int64TyConName,
183 wordTyConName, word8TyConName, word16TyConName, word32TyConName, word64TyConName,
187 plusIntegerName, timesIntegerName,
188 eqStringName, assertName, breakpointName, breakpointCondName,
189 assertErrorName, runSTRepName,
190 printName, fstName, sndName,
193 monadFixClassName, mfixName,
196 randomClassName, randomGenClassName, monadPlusClassName,
202 , eitherTyConName, leftDataConName, rightDataConName
205 , objectTyConName, marshalObjectName, unmarshalObjectName
206 , marshalStringName, unmarshalStringName, checkDotnetResName
209 genericTyConNames :: [Name]
210 genericTyConNames = [crossTyConName, plusTyConName, genUnitTyConName]
214 %************************************************************************
216 \subsection{Module names}
218 %************************************************************************
221 --MetaHaskell Extension Add a new module here
223 pRELUDE = mkBaseModule_ pRELUDE_NAME
224 gHC_PRIM = mkBaseModule FSLIT("GHC.Prim") -- Primitive types and values
225 gHC_BASE = mkBaseModule FSLIT("GHC.Base")
226 gHC_ENUM = mkBaseModule FSLIT("GHC.Enum")
227 gHC_SHOW = mkBaseModule FSLIT("GHC.Show")
228 gHC_READ = mkBaseModule FSLIT("GHC.Read")
229 gHC_NUM = mkBaseModule FSLIT("GHC.Num")
230 gHC_LIST = mkBaseModule FSLIT("GHC.List")
231 gHC_PARR = mkBaseModule FSLIT("GHC.PArr")
232 dATA_TUP = mkBaseModule FSLIT("Data.Tuple")
233 dATA_EITHER = mkBaseModule FSLIT("Data.Either")
234 gHC_PACK = mkBaseModule FSLIT("GHC.Pack")
235 gHC_CONC = mkBaseModule FSLIT("GHC.Conc")
236 gHC_IO_BASE = mkBaseModule FSLIT("GHC.IOBase")
237 gHC_ST = mkBaseModule FSLIT("GHC.ST")
238 gHC_ARR = mkBaseModule FSLIT("GHC.Arr")
239 gHC_STABLE = mkBaseModule FSLIT("GHC.Stable")
240 gHC_ADDR = mkBaseModule FSLIT("GHC.Addr")
241 gHC_PTR = mkBaseModule FSLIT("GHC.Ptr")
242 gHC_ERR = mkBaseModule FSLIT("GHC.Err")
243 gHC_REAL = mkBaseModule FSLIT("GHC.Real")
244 gHC_FLOAT = mkBaseModule FSLIT("GHC.Float")
245 gHC_TOP_HANDLER = mkBaseModule FSLIT("GHC.TopHandler")
246 sYSTEM_IO = mkBaseModule FSLIT("System.IO")
247 dYNAMIC = mkBaseModule FSLIT("Data.Dynamic")
248 tYPEABLE = mkBaseModule FSLIT("Data.Typeable")
249 gENERICS = mkBaseModule FSLIT("Data.Generics.Basics")
250 dOTNET = mkBaseModule FSLIT("GHC.Dotnet")
251 rEAD_PREC = mkBaseModule FSLIT("Text.ParserCombinators.ReadPrec")
252 lEX = mkBaseModule FSLIT("Text.Read.Lex")
253 gHC_INT = mkBaseModule FSLIT("GHC.Int")
254 gHC_WORD = mkBaseModule FSLIT("GHC.Word")
255 mONAD = mkBaseModule FSLIT("Control.Monad")
256 mONAD_FIX = mkBaseModule FSLIT("Control.Monad.Fix")
257 aRROW = mkBaseModule FSLIT("Control.Arrow")
258 rANDOM = mkBaseModule FSLIT("System.Random")
259 gLA_EXTS = mkBaseModule FSLIT("GHC.Exts")
261 mAIN = mkMainModule_ mAIN_NAME
262 rOOT_MAIN = mkMainModule FSLIT(":Main") -- Root module for initialisation
264 -- The ':xxx' makes a module name that the user can never
265 -- use himself. The z-encoding for ':' is "ZC", so the z-encoded
266 -- module name still starts with a capital letter, which keeps
267 -- the z-encoded version consistent.
268 iNTERACTIVE = mkMainModule FSLIT(":Interactive")
269 thFAKE = mkMainModule FSLIT(":THFake")
271 pRELUDE_NAME = mkModuleNameFS FSLIT("Prelude")
272 mAIN_NAME = mkModuleNameFS FSLIT("Main")
274 mkBaseModule :: FastString -> Module
275 mkBaseModule m = mkModule basePackageId (mkModuleNameFS m)
277 mkBaseModule_ :: ModuleName -> Module
278 mkBaseModule_ m = mkModule basePackageId m
280 mkMainModule :: FastString -> Module
281 mkMainModule m = mkModule mainPackageId (mkModuleNameFS m)
283 mkMainModule_ :: ModuleName -> Module
284 mkMainModule_ m = mkModule mainPackageId m
287 %************************************************************************
289 \subsection{Constructing the names of tuples
291 %************************************************************************
294 mkTupleModule :: Boxity -> Arity -> Module
295 mkTupleModule Boxed 0 = gHC_BASE
296 mkTupleModule Boxed _ = dATA_TUP
297 mkTupleModule Unboxed _ = gHC_PRIM
301 %************************************************************************
305 %************************************************************************
308 main_RDR_Unqual = mkUnqual varName FSLIT("main")
309 -- We definitely don't want an Orig RdrName, because
310 -- main might, in principle, be imported into module Main
312 eq_RDR = nameRdrName eqName
313 ge_RDR = nameRdrName geName
314 ne_RDR = varQual_RDR gHC_BASE FSLIT("/=")
315 le_RDR = varQual_RDR gHC_BASE FSLIT("<=")
316 gt_RDR = varQual_RDR gHC_BASE FSLIT(">")
317 compare_RDR = varQual_RDR gHC_BASE FSLIT("compare")
318 ltTag_RDR = dataQual_RDR gHC_BASE FSLIT("LT")
319 eqTag_RDR = dataQual_RDR gHC_BASE FSLIT("EQ")
320 gtTag_RDR = dataQual_RDR gHC_BASE FSLIT("GT")
322 eqClass_RDR = nameRdrName eqClassName
323 numClass_RDR = nameRdrName numClassName
324 ordClass_RDR = nameRdrName ordClassName
325 enumClass_RDR = nameRdrName enumClassName
326 monadClass_RDR = nameRdrName monadClassName
328 map_RDR = varQual_RDR gHC_BASE FSLIT("map")
329 append_RDR = varQual_RDR gHC_BASE FSLIT("++")
331 foldr_RDR = nameRdrName foldrName
332 build_RDR = nameRdrName buildName
333 returnM_RDR = nameRdrName returnMName
334 bindM_RDR = nameRdrName bindMName
335 failM_RDR = nameRdrName failMName
337 and_RDR = nameRdrName andName
339 left_RDR = nameRdrName leftDataConName
340 right_RDR = nameRdrName rightDataConName
342 fromEnum_RDR = varQual_RDR gHC_ENUM FSLIT("fromEnum")
343 toEnum_RDR = varQual_RDR gHC_ENUM FSLIT("toEnum")
345 enumFrom_RDR = nameRdrName enumFromName
346 enumFromTo_RDR = nameRdrName enumFromToName
347 enumFromThen_RDR = nameRdrName enumFromThenName
348 enumFromThenTo_RDR = nameRdrName enumFromThenToName
350 ratioDataCon_RDR = nameRdrName ratioDataConName
351 plusInteger_RDR = nameRdrName plusIntegerName
352 timesInteger_RDR = nameRdrName timesIntegerName
354 ioDataCon_RDR = nameRdrName ioDataConName
356 eqString_RDR = nameRdrName eqStringName
357 unpackCString_RDR = nameRdrName unpackCStringName
358 unpackCStringFoldr_RDR = nameRdrName unpackCStringFoldrName
359 unpackCStringUtf8_RDR = nameRdrName unpackCStringUtf8Name
361 newStablePtr_RDR = nameRdrName newStablePtrName
362 wordDataCon_RDR = dataQual_RDR gHC_WORD FSLIT("W#")
364 bindIO_RDR = nameRdrName bindIOName
365 returnIO_RDR = nameRdrName returnIOName
367 fromInteger_RDR = nameRdrName fromIntegerName
368 fromRational_RDR = nameRdrName fromRationalName
369 minus_RDR = nameRdrName minusName
370 times_RDR = varQual_RDR gHC_NUM FSLIT("*")
371 plus_RDR = varQual_RDR gHC_NUM FSLIT("+")
373 compose_RDR = varQual_RDR gHC_BASE FSLIT(".")
375 not_RDR = varQual_RDR gHC_BASE FSLIT("not")
376 getTag_RDR = varQual_RDR gHC_BASE FSLIT("getTag")
377 succ_RDR = varQual_RDR gHC_ENUM FSLIT("succ")
378 pred_RDR = varQual_RDR gHC_ENUM FSLIT("pred")
379 minBound_RDR = varQual_RDR gHC_ENUM FSLIT("minBound")
380 maxBound_RDR = varQual_RDR gHC_ENUM FSLIT("maxBound")
381 range_RDR = varQual_RDR gHC_ARR FSLIT("range")
382 inRange_RDR = varQual_RDR gHC_ARR FSLIT("inRange")
383 index_RDR = varQual_RDR gHC_ARR FSLIT("index")
384 unsafeIndex_RDR = varQual_RDR gHC_ARR FSLIT("unsafeIndex")
385 unsafeRangeSize_RDR = varQual_RDR gHC_ARR FSLIT("unsafeRangeSize")
387 readList_RDR = varQual_RDR gHC_READ FSLIT("readList")
388 readListDefault_RDR = varQual_RDR gHC_READ FSLIT("readListDefault")
389 readListPrec_RDR = varQual_RDR gHC_READ FSLIT("readListPrec")
390 readListPrecDefault_RDR = varQual_RDR gHC_READ FSLIT("readListPrecDefault")
391 readPrec_RDR = varQual_RDR gHC_READ FSLIT("readPrec")
392 parens_RDR = varQual_RDR gHC_READ FSLIT("parens")
393 choose_RDR = varQual_RDR gHC_READ FSLIT("choose")
394 lexP_RDR = varQual_RDR gHC_READ FSLIT("lexP")
396 punc_RDR = dataQual_RDR lEX FSLIT("Punc")
397 ident_RDR = dataQual_RDR lEX FSLIT("Ident")
398 symbol_RDR = dataQual_RDR lEX FSLIT("Symbol")
400 step_RDR = varQual_RDR rEAD_PREC FSLIT("step")
401 alt_RDR = varQual_RDR rEAD_PREC FSLIT("+++")
402 reset_RDR = varQual_RDR rEAD_PREC FSLIT("reset")
403 prec_RDR = varQual_RDR rEAD_PREC FSLIT("prec")
405 showList_RDR = varQual_RDR gHC_SHOW FSLIT("showList")
406 showList___RDR = varQual_RDR gHC_SHOW FSLIT("showList__")
407 showsPrec_RDR = varQual_RDR gHC_SHOW FSLIT("showsPrec")
408 showString_RDR = varQual_RDR gHC_SHOW FSLIT("showString")
409 showSpace_RDR = varQual_RDR gHC_SHOW FSLIT("showSpace")
410 showParen_RDR = varQual_RDR gHC_SHOW FSLIT("showParen")
412 typeOf_RDR = varQual_RDR tYPEABLE FSLIT("typeOf")
413 mkTypeRep_RDR = varQual_RDR tYPEABLE FSLIT("mkTyConApp")
414 mkTyConRep_RDR = varQual_RDR tYPEABLE FSLIT("mkTyCon")
416 undefined_RDR = varQual_RDR gHC_ERR FSLIT("undefined")
418 crossDataCon_RDR = dataQual_RDR gHC_BASE FSLIT(":*:")
419 inlDataCon_RDR = dataQual_RDR gHC_BASE FSLIT("Inl")
420 inrDataCon_RDR = dataQual_RDR gHC_BASE FSLIT("Inr")
421 genUnitDataCon_RDR = dataQual_RDR gHC_BASE FSLIT("Unit")
423 ----------------------
424 varQual_RDR mod str = mkOrig mod (mkOccNameFS varName str)
425 tcQual_RDR mod str = mkOrig mod (mkOccNameFS tcName str)
426 clsQual_RDR mod str = mkOrig mod (mkOccNameFS clsName str)
427 dataQual_RDR mod str = mkOrig mod (mkOccNameFS dataName str)
430 %************************************************************************
432 \subsection{Known-key names}
434 %************************************************************************
436 Many of these Names are not really "built in", but some parts of the
437 compiler (notably the deriving mechanism) need to mention their names,
438 and it's convenient to write them all down in one place.
440 --MetaHaskell Extension add the constrs and the lower case case
441 -- guys as well (perhaps) e.g. see trueDataConName below
445 runMainIOName = varQual gHC_TOP_HANDLER FSLIT("runMainIO") runMainKey
447 orderingTyConName = tcQual gHC_BASE FSLIT("Ordering") orderingTyConKey
449 eitherTyConName = tcQual dATA_EITHER FSLIT("Either") eitherTyConKey
450 leftDataConName = conName dATA_EITHER FSLIT("Left") leftDataConKey
451 rightDataConName = conName dATA_EITHER FSLIT("Right") rightDataConKey
454 crossTyConName = tcQual gHC_BASE FSLIT(":*:") crossTyConKey
455 plusTyConName = tcQual gHC_BASE FSLIT(":+:") plusTyConKey
456 genUnitTyConName = tcQual gHC_BASE FSLIT("Unit") genUnitTyConKey
458 -- Base strings Strings
459 unpackCStringName = varQual gHC_BASE FSLIT("unpackCString#") unpackCStringIdKey
460 unpackCStringAppendName = varQual gHC_BASE FSLIT("unpackAppendCString#") unpackCStringAppendIdKey
461 unpackCStringFoldrName = varQual gHC_BASE FSLIT("unpackFoldrCString#") unpackCStringFoldrIdKey
462 unpackCStringUtf8Name = varQual gHC_BASE FSLIT("unpackCStringUtf8#") unpackCStringUtf8IdKey
463 eqStringName = varQual gHC_BASE FSLIT("eqString") eqStringIdKey
465 -- The 'inline' function
466 inlineIdName = varQual gHC_BASE FSLIT("inline") inlineIdKey
468 -- Base classes (Eq, Ord, Functor)
469 eqClassName = clsQual gHC_BASE FSLIT("Eq") eqClassKey
470 eqName = methName gHC_BASE FSLIT("==") eqClassOpKey
471 ordClassName = clsQual gHC_BASE FSLIT("Ord") ordClassKey
472 geName = methName gHC_BASE FSLIT(">=") geClassOpKey
473 functorClassName = clsQual gHC_BASE FSLIT("Functor") functorClassKey
476 monadClassName = clsQual gHC_BASE FSLIT("Monad") monadClassKey
477 thenMName = methName gHC_BASE FSLIT(">>") thenMClassOpKey
478 bindMName = methName gHC_BASE FSLIT(">>=") bindMClassOpKey
479 returnMName = methName gHC_BASE FSLIT("return") returnMClassOpKey
480 failMName = methName gHC_BASE FSLIT("fail") failMClassOpKey
482 -- Random PrelBase functions
483 otherwiseIdName = varQual gHC_BASE FSLIT("otherwise") otherwiseIdKey
484 foldrName = varQual gHC_BASE FSLIT("foldr") foldrIdKey
485 buildName = varQual gHC_BASE FSLIT("build") buildIdKey
486 augmentName = varQual gHC_BASE FSLIT("augment") augmentIdKey
487 appendName = varQual gHC_BASE FSLIT("++") appendIdKey
488 andName = varQual gHC_BASE FSLIT("&&") andIdKey
489 orName = varQual gHC_BASE FSLIT("||") orIdKey
490 assertName = varQual gHC_BASE FSLIT("assert") assertIdKey
491 breakpointName = varQual gHC_BASE FSLIT("breakpoint") breakpointIdKey
492 breakpointCondName= varQual gHC_BASE FSLIT("breakpointCond") breakpointCondIdKey
496 (mkOccNameFS varName FSLIT("breakpointJump"))
498 breakpointCondJumpName
500 breakpointCondJumpIdKey
501 (mkOccNameFS varName FSLIT("breakpointCondJump"))
505 fstName = varQual dATA_TUP FSLIT("fst") fstIdKey
506 sndName = varQual dATA_TUP FSLIT("snd") sndIdKey
509 numClassName = clsQual gHC_NUM FSLIT("Num") numClassKey
510 fromIntegerName = methName gHC_NUM FSLIT("fromInteger") fromIntegerClassOpKey
511 minusName = methName gHC_NUM FSLIT("-") minusClassOpKey
512 negateName = methName gHC_NUM FSLIT("negate") negateClassOpKey
513 plusIntegerName = varQual gHC_NUM FSLIT("plusInteger") plusIntegerIdKey
514 timesIntegerName = varQual gHC_NUM FSLIT("timesInteger") timesIntegerIdKey
515 integerTyConName = tcQual gHC_NUM FSLIT("Integer") integerTyConKey
516 smallIntegerDataConName = conName gHC_NUM FSLIT("S#") smallIntegerDataConKey
517 largeIntegerDataConName = conName gHC_NUM FSLIT("J#") largeIntegerDataConKey
519 -- PrelReal types and classes
520 rationalTyConName = tcQual gHC_REAL FSLIT("Rational") rationalTyConKey
521 ratioTyConName = tcQual gHC_REAL FSLIT("Ratio") ratioTyConKey
522 ratioDataConName = conName gHC_REAL FSLIT(":%") ratioDataConKey
523 realClassName = clsQual gHC_REAL FSLIT("Real") realClassKey
524 integralClassName = clsQual gHC_REAL FSLIT("Integral") integralClassKey
525 realFracClassName = clsQual gHC_REAL FSLIT("RealFrac") realFracClassKey
526 fractionalClassName = clsQual gHC_REAL FSLIT("Fractional") fractionalClassKey
527 fromRationalName = methName gHC_REAL FSLIT("fromRational") fromRationalClassOpKey
530 floatingClassName = clsQual gHC_FLOAT FSLIT("Floating") floatingClassKey
531 realFloatClassName = clsQual gHC_FLOAT FSLIT("RealFloat") realFloatClassKey
534 ixClassName = clsQual gHC_ARR FSLIT("Ix") ixClassKey
537 typeableClassName = clsQual tYPEABLE FSLIT("Typeable") typeableClassKey
538 typeable1ClassName = clsQual tYPEABLE FSLIT("Typeable1") typeable1ClassKey
539 typeable2ClassName = clsQual tYPEABLE FSLIT("Typeable2") typeable2ClassKey
540 typeable3ClassName = clsQual tYPEABLE FSLIT("Typeable3") typeable3ClassKey
541 typeable4ClassName = clsQual tYPEABLE FSLIT("Typeable4") typeable4ClassKey
542 typeable5ClassName = clsQual tYPEABLE FSLIT("Typeable5") typeable5ClassKey
543 typeable6ClassName = clsQual tYPEABLE FSLIT("Typeable6") typeable6ClassKey
544 typeable7ClassName = clsQual tYPEABLE FSLIT("Typeable7") typeable7ClassKey
546 typeableClassNames = [ typeableClassName, typeable1ClassName, typeable2ClassName
547 , typeable3ClassName, typeable4ClassName, typeable5ClassName
548 , typeable6ClassName, typeable7ClassName ]
551 dataClassName = clsQual gENERICS FSLIT("Data") dataClassKey
554 assertErrorName = varQual gHC_ERR FSLIT("assertError") assertErrorIdKey
556 -- Enum module (Enum, Bounded)
557 enumClassName = clsQual gHC_ENUM FSLIT("Enum") enumClassKey
558 enumFromName = methName gHC_ENUM FSLIT("enumFrom") enumFromClassOpKey
559 enumFromToName = methName gHC_ENUM FSLIT("enumFromTo") enumFromToClassOpKey
560 enumFromThenName = methName gHC_ENUM FSLIT("enumFromThen") enumFromThenClassOpKey
561 enumFromThenToName = methName gHC_ENUM FSLIT("enumFromThenTo") enumFromThenToClassOpKey
562 boundedClassName = clsQual gHC_ENUM FSLIT("Bounded") boundedClassKey
565 concatName = varQual gHC_LIST FSLIT("concat") concatIdKey
566 filterName = varQual gHC_LIST FSLIT("filter") filterIdKey
567 zipName = varQual gHC_LIST FSLIT("zip") zipIdKey
570 showClassName = clsQual gHC_SHOW FSLIT("Show") showClassKey
573 readClassName = clsQual gHC_READ FSLIT("Read") readClassKey
575 -- parallel array types and functions
576 enumFromToPName = varQual gHC_PARR FSLIT("enumFromToP") enumFromToPIdKey
577 enumFromThenToPName= varQual gHC_PARR FSLIT("enumFromThenToP") enumFromThenToPIdKey
578 nullPName = varQual gHC_PARR FSLIT("nullP") nullPIdKey
579 lengthPName = varQual gHC_PARR FSLIT("lengthP") lengthPIdKey
580 replicatePName = varQual gHC_PARR FSLIT("replicateP") replicatePIdKey
581 mapPName = varQual gHC_PARR FSLIT("mapP") mapPIdKey
582 filterPName = varQual gHC_PARR FSLIT("filterP") filterPIdKey
583 zipPName = varQual gHC_PARR FSLIT("zipP") zipPIdKey
584 crossPName = varQual gHC_PARR FSLIT("crossP") crossPIdKey
585 indexPName = varQual gHC_PARR FSLIT("!:") indexPIdKey
586 toPName = varQual gHC_PARR FSLIT("toP") toPIdKey
587 bpermutePName = varQual gHC_PARR FSLIT("bpermuteP") bpermutePIdKey
588 bpermuteDftPName = varQual gHC_PARR FSLIT("bpermuteDftP") bpermuteDftPIdKey
589 indexOfPName = varQual gHC_PARR FSLIT("indexOfP") indexOfPIdKey
592 ioTyConName = tcQual gHC_IO_BASE FSLIT("IO") ioTyConKey
593 ioDataConName = conName gHC_IO_BASE FSLIT("IO") ioDataConKey
594 thenIOName = varQual gHC_IO_BASE FSLIT("thenIO") thenIOIdKey
595 bindIOName = varQual gHC_IO_BASE FSLIT("bindIO") bindIOIdKey
596 returnIOName = varQual gHC_IO_BASE FSLIT("returnIO") returnIOIdKey
597 failIOName = varQual gHC_IO_BASE FSLIT("failIO") failIOIdKey
600 printName = varQual sYSTEM_IO FSLIT("print") printIdKey
602 -- Int, Word, and Addr things
603 int8TyConName = tcQual gHC_INT FSLIT("Int8") int8TyConKey
604 int16TyConName = tcQual gHC_INT FSLIT("Int16") int16TyConKey
605 int32TyConName = tcQual gHC_INT FSLIT("Int32") int32TyConKey
606 int64TyConName = tcQual gHC_INT FSLIT("Int64") int64TyConKey
609 word8TyConName = tcQual gHC_WORD FSLIT("Word8") word8TyConKey
610 word16TyConName = tcQual gHC_WORD FSLIT("Word16") word16TyConKey
611 word32TyConName = tcQual gHC_WORD FSLIT("Word32") word32TyConKey
612 word64TyConName = tcQual gHC_WORD FSLIT("Word64") word64TyConKey
613 wordTyConName = tcQual gHC_WORD FSLIT("Word") wordTyConKey
614 wordDataConName = conName gHC_WORD FSLIT("W#") wordDataConKey
617 ptrTyConName = tcQual gHC_PTR FSLIT("Ptr") ptrTyConKey
618 funPtrTyConName = tcQual gHC_PTR FSLIT("FunPtr") funPtrTyConKey
620 -- Foreign objects and weak pointers
621 stablePtrTyConName = tcQual gHC_STABLE FSLIT("StablePtr") stablePtrTyConKey
622 newStablePtrName = varQual gHC_STABLE FSLIT("newStablePtr") newStablePtrIdKey
625 runSTRepName = varQual gHC_ST FSLIT("runSTRep") runSTRepIdKey
627 -- Recursive-do notation
628 monadFixClassName = clsQual mONAD_FIX FSLIT("MonadFix") monadFixClassKey
629 mfixName = methName mONAD_FIX FSLIT("mfix") mfixIdKey
632 arrAName = varQual aRROW FSLIT("arr") arrAIdKey
633 composeAName = varQual aRROW FSLIT(">>>") composeAIdKey
634 firstAName = varQual aRROW FSLIT("first") firstAIdKey
635 appAName = varQual aRROW FSLIT("app") appAIdKey
636 choiceAName = varQual aRROW FSLIT("|||") choiceAIdKey
637 loopAName = varQual aRROW FSLIT("loop") loopAIdKey
639 -- Other classes, needed for type defaulting
640 monadPlusClassName = clsQual mONAD FSLIT("MonadPlus") monadPlusClassKey
641 randomClassName = clsQual rANDOM FSLIT("Random") randomClassKey
642 randomGenClassName = clsQual rANDOM FSLIT("RandomGen") randomGenClassKey
645 objectTyConName = tcQual dOTNET FSLIT("Object") objectTyConKey
646 -- objectTyConName was "wTcQual", but that's gone now, and
647 -- I can't see why it was wired in anyway...
648 unmarshalObjectName = varQual dOTNET FSLIT("unmarshalObject") unmarshalObjectIdKey
649 marshalObjectName = varQual dOTNET FSLIT("marshalObject") marshalObjectIdKey
650 marshalStringName = varQual dOTNET FSLIT("marshalString") marshalStringIdKey
651 unmarshalStringName = varQual dOTNET FSLIT("unmarshalString") unmarshalStringIdKey
652 checkDotnetResName = varQual dOTNET FSLIT("checkResult") checkDotnetResNameIdKey
655 %************************************************************************
657 \subsection{Local helpers}
659 %************************************************************************
661 All these are original names; hence mkOrig
664 varQual = mk_known_key_name varName
665 tcQual = mk_known_key_name tcName
666 clsQual = mk_known_key_name clsName
668 mk_known_key_name space mod str uniq
669 = mkExternalName uniq mod (mkOccNameFS space str) noSrcLoc
671 conName :: Module -> FastString -> Unique -> Name
673 = mkExternalName uniq mod (mkOccNameFS dataName occ) noSrcLoc
675 methName :: Module -> FastString -> Unique -> Name
676 methName mod occ uniq
677 = mkExternalName uniq mod (mkVarOccFS occ) noSrcLoc
680 %************************************************************************
682 \subsubsection[Uniques-prelude-Classes]{@Uniques@ for wired-in @Classes@}
684 %************************************************************************
685 --MetaHaskell extension hand allocate keys here
688 boundedClassKey = mkPreludeClassUnique 1
689 enumClassKey = mkPreludeClassUnique 2
690 eqClassKey = mkPreludeClassUnique 3
691 floatingClassKey = mkPreludeClassUnique 5
692 fractionalClassKey = mkPreludeClassUnique 6
693 integralClassKey = mkPreludeClassUnique 7
694 monadClassKey = mkPreludeClassUnique 8
695 dataClassKey = mkPreludeClassUnique 9
696 functorClassKey = mkPreludeClassUnique 10
697 numClassKey = mkPreludeClassUnique 11
698 ordClassKey = mkPreludeClassUnique 12
699 readClassKey = mkPreludeClassUnique 13
700 realClassKey = mkPreludeClassUnique 14
701 realFloatClassKey = mkPreludeClassUnique 15
702 realFracClassKey = mkPreludeClassUnique 16
703 showClassKey = mkPreludeClassUnique 17
704 ixClassKey = mkPreludeClassUnique 18
706 typeableClassKey = mkPreludeClassUnique 20
707 typeable1ClassKey = mkPreludeClassUnique 21
708 typeable2ClassKey = mkPreludeClassUnique 22
709 typeable3ClassKey = mkPreludeClassUnique 23
710 typeable4ClassKey = mkPreludeClassUnique 24
711 typeable5ClassKey = mkPreludeClassUnique 25
712 typeable6ClassKey = mkPreludeClassUnique 26
713 typeable7ClassKey = mkPreludeClassUnique 27
715 monadFixClassKey = mkPreludeClassUnique 28
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 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
762 anyPrimTyConKey = mkPreludeTyConUnique 37
763 anyPrimTyCon1Key = mkPreludeTyConUnique 38
765 statePrimTyConKey = mkPreludeTyConUnique 50
766 stableNamePrimTyConKey = mkPreludeTyConUnique 51
767 stableNameTyConKey = mkPreludeTyConUnique 52
768 mutVarPrimTyConKey = mkPreludeTyConUnique 55
769 ioTyConKey = mkPreludeTyConUnique 56
770 wordPrimTyConKey = mkPreludeTyConUnique 58
771 wordTyConKey = mkPreludeTyConUnique 59
772 word8TyConKey = mkPreludeTyConUnique 60
773 word16TyConKey = mkPreludeTyConUnique 61
774 word32PrimTyConKey = mkPreludeTyConUnique 62
775 word32TyConKey = mkPreludeTyConUnique 63
776 word64PrimTyConKey = mkPreludeTyConUnique 64
777 word64TyConKey = mkPreludeTyConUnique 65
778 liftedConKey = mkPreludeTyConUnique 66
779 unliftedConKey = mkPreludeTyConUnique 67
780 anyBoxConKey = mkPreludeTyConUnique 68
781 kindConKey = mkPreludeTyConUnique 69
782 boxityConKey = mkPreludeTyConUnique 70
783 typeConKey = mkPreludeTyConUnique 71
784 threadIdPrimTyConKey = mkPreludeTyConUnique 72
785 bcoPrimTyConKey = mkPreludeTyConUnique 73
786 ptrTyConKey = mkPreludeTyConUnique 74
787 funPtrTyConKey = mkPreludeTyConUnique 75
788 tVarPrimTyConKey = mkPreludeTyConUnique 76
790 -- Generic Type Constructors
791 crossTyConKey = mkPreludeTyConUnique 79
792 plusTyConKey = mkPreludeTyConUnique 80
793 genUnitTyConKey = mkPreludeTyConUnique 81
795 -- Parallel array type constructor
796 parrTyConKey = mkPreludeTyConUnique 82
799 objectTyConKey = mkPreludeTyConUnique 83
801 eitherTyConKey = mkPreludeTyConUnique 84
803 -- Super Kinds constructors
804 tySuperKindTyConKey = mkPreludeTyConUnique 85
805 coSuperKindTyConKey = mkPreludeTyConUnique 86
808 liftedTypeKindTyConKey = mkPreludeTyConUnique 87
809 openTypeKindTyConKey = mkPreludeTyConUnique 88
810 unliftedTypeKindTyConKey = mkPreludeTyConUnique 89
811 ubxTupleKindTyConKey = mkPreludeTyConUnique 90
812 argTypeKindTyConKey = mkPreludeTyConUnique 91
814 -- Coercion constructors
815 symCoercionTyConKey = mkPreludeTyConUnique 93
816 transCoercionTyConKey = mkPreludeTyConUnique 94
817 leftCoercionTyConKey = mkPreludeTyConUnique 95
818 rightCoercionTyConKey = mkPreludeTyConUnique 96
819 instCoercionTyConKey = mkPreludeTyConUnique 97
820 unsafeCoercionTyConKey = mkPreludeTyConUnique 98
823 ---------------- Template Haskell -------------------
824 -- USES TyConUniques 100-129
825 -----------------------------------------------------
827 unitTyConKey = mkTupleTyConUnique Boxed 0
830 %************************************************************************
832 \subsubsection[Uniques-prelude-DataCons]{@Uniques@ for wired-in @DataCons@}
834 %************************************************************************
837 charDataConKey = mkPreludeDataConUnique 1
838 consDataConKey = mkPreludeDataConUnique 2
839 doubleDataConKey = mkPreludeDataConUnique 3
840 falseDataConKey = mkPreludeDataConUnique 4
841 floatDataConKey = mkPreludeDataConUnique 5
842 intDataConKey = mkPreludeDataConUnique 6
843 smallIntegerDataConKey = mkPreludeDataConUnique 7
844 largeIntegerDataConKey = mkPreludeDataConUnique 8
845 nilDataConKey = mkPreludeDataConUnique 11
846 ratioDataConKey = mkPreludeDataConUnique 12
847 stableNameDataConKey = mkPreludeDataConUnique 14
848 trueDataConKey = mkPreludeDataConUnique 15
849 wordDataConKey = mkPreludeDataConUnique 16
850 ioDataConKey = mkPreludeDataConUnique 17
852 -- Generic data constructors
853 crossDataConKey = mkPreludeDataConUnique 20
854 inlDataConKey = mkPreludeDataConUnique 21
855 inrDataConKey = mkPreludeDataConUnique 22
856 genUnitDataConKey = mkPreludeDataConUnique 23
858 -- Data constructor for parallel arrays
859 parrDataConKey = mkPreludeDataConUnique 24
861 leftDataConKey = mkPreludeDataConUnique 25
862 rightDataConKey = mkPreludeDataConUnique 26
865 %************************************************************************
867 \subsubsection[Uniques-prelude-Ids]{@Uniques@ for wired-in @Ids@ (except @DataCons@)}
869 %************************************************************************
872 absentErrorIdKey = mkPreludeMiscIdUnique 1
873 augmentIdKey = mkPreludeMiscIdUnique 3
874 appendIdKey = mkPreludeMiscIdUnique 4
875 buildIdKey = mkPreludeMiscIdUnique 5
876 errorIdKey = mkPreludeMiscIdUnique 6
877 foldlIdKey = mkPreludeMiscIdUnique 7
878 foldrIdKey = mkPreludeMiscIdUnique 8
879 recSelErrorIdKey = mkPreludeMiscIdUnique 9
880 integerMinusOneIdKey = mkPreludeMiscIdUnique 10
881 integerPlusOneIdKey = mkPreludeMiscIdUnique 11
882 integerPlusTwoIdKey = mkPreludeMiscIdUnique 12
883 integerZeroIdKey = mkPreludeMiscIdUnique 13
884 int2IntegerIdKey = mkPreludeMiscIdUnique 14
885 seqIdKey = mkPreludeMiscIdUnique 15
886 irrefutPatErrorIdKey = mkPreludeMiscIdUnique 16
887 eqStringIdKey = mkPreludeMiscIdUnique 17
888 noMethodBindingErrorIdKey = mkPreludeMiscIdUnique 18
889 nonExhaustiveGuardsErrorIdKey = mkPreludeMiscIdUnique 19
890 runtimeErrorIdKey = mkPreludeMiscIdUnique 20
891 parErrorIdKey = mkPreludeMiscIdUnique 21
892 parIdKey = mkPreludeMiscIdUnique 22
893 patErrorIdKey = mkPreludeMiscIdUnique 23
894 realWorldPrimIdKey = mkPreludeMiscIdUnique 24
895 recConErrorIdKey = mkPreludeMiscIdUnique 25
896 recUpdErrorIdKey = mkPreludeMiscIdUnique 26
897 traceIdKey = mkPreludeMiscIdUnique 27
898 unpackCStringUtf8IdKey = mkPreludeMiscIdUnique 28
899 unpackCStringAppendIdKey = mkPreludeMiscIdUnique 29
900 unpackCStringFoldrIdKey = mkPreludeMiscIdUnique 30
901 unpackCStringIdKey = mkPreludeMiscIdUnique 31
903 unsafeCoerceIdKey = mkPreludeMiscIdUnique 32
904 concatIdKey = mkPreludeMiscIdUnique 33
905 filterIdKey = mkPreludeMiscIdUnique 34
906 zipIdKey = mkPreludeMiscIdUnique 35
907 bindIOIdKey = mkPreludeMiscIdUnique 36
908 returnIOIdKey = mkPreludeMiscIdUnique 37
909 deRefStablePtrIdKey = mkPreludeMiscIdUnique 38
910 newStablePtrIdKey = mkPreludeMiscIdUnique 39
911 plusIntegerIdKey = mkPreludeMiscIdUnique 41
912 timesIntegerIdKey = mkPreludeMiscIdUnique 42
913 printIdKey = mkPreludeMiscIdUnique 43
914 failIOIdKey = mkPreludeMiscIdUnique 44
915 nullAddrIdKey = mkPreludeMiscIdUnique 46
916 voidArgIdKey = mkPreludeMiscIdUnique 47
917 fstIdKey = mkPreludeMiscIdUnique 49
918 sndIdKey = mkPreludeMiscIdUnique 50
919 otherwiseIdKey = mkPreludeMiscIdUnique 51
920 assertIdKey = mkPreludeMiscIdUnique 53
921 runSTRepIdKey = mkPreludeMiscIdUnique 54
923 rootMainKey = mkPreludeMiscIdUnique 55
924 runMainKey = mkPreludeMiscIdUnique 56
926 andIdKey = mkPreludeMiscIdUnique 57
927 orIdKey = mkPreludeMiscIdUnique 58
928 thenIOIdKey = mkPreludeMiscIdUnique 59
929 lazyIdKey = mkPreludeMiscIdUnique 60
930 assertErrorIdKey = mkPreludeMiscIdUnique 61
932 breakpointIdKey = mkPreludeMiscIdUnique 62
933 breakpointCondIdKey = mkPreludeMiscIdUnique 63
934 breakpointJumpIdKey = mkPreludeMiscIdUnique 64
935 breakpointCondJumpIdKey = mkPreludeMiscIdUnique 65
937 inlineIdKey = mkPreludeMiscIdUnique 66
939 -- Parallel array functions
940 nullPIdKey = mkPreludeMiscIdUnique 80
941 lengthPIdKey = mkPreludeMiscIdUnique 81
942 replicatePIdKey = mkPreludeMiscIdUnique 82
943 mapPIdKey = mkPreludeMiscIdUnique 83
944 filterPIdKey = mkPreludeMiscIdUnique 84
945 zipPIdKey = mkPreludeMiscIdUnique 85
946 crossPIdKey = mkPreludeMiscIdUnique 86
947 indexPIdKey = mkPreludeMiscIdUnique 87
948 toPIdKey = mkPreludeMiscIdUnique 88
949 enumFromToPIdKey = mkPreludeMiscIdUnique 89
950 enumFromThenToPIdKey = mkPreludeMiscIdUnique 90
951 bpermutePIdKey = mkPreludeMiscIdUnique 91
952 bpermuteDftPIdKey = mkPreludeMiscIdUnique 92
953 indexOfPIdKey = mkPreludeMiscIdUnique 93
956 unmarshalObjectIdKey = mkPreludeMiscIdUnique 94
957 marshalObjectIdKey = mkPreludeMiscIdUnique 95
958 marshalStringIdKey = mkPreludeMiscIdUnique 96
959 unmarshalStringIdKey = mkPreludeMiscIdUnique 97
960 checkDotnetResNameIdKey = mkPreludeMiscIdUnique 98
964 Certain class operations from Prelude classes. They get their own
965 uniques so we can look them up easily when we want to conjure them up
966 during type checking.
969 -- Just a place holder for unbound variables produced by the renamer:
970 unboundKey = mkPreludeMiscIdUnique 101
972 fromIntegerClassOpKey = mkPreludeMiscIdUnique 102
973 minusClassOpKey = mkPreludeMiscIdUnique 103
974 fromRationalClassOpKey = mkPreludeMiscIdUnique 104
975 enumFromClassOpKey = mkPreludeMiscIdUnique 105
976 enumFromThenClassOpKey = mkPreludeMiscIdUnique 106
977 enumFromToClassOpKey = mkPreludeMiscIdUnique 107
978 enumFromThenToClassOpKey = mkPreludeMiscIdUnique 108
979 eqClassOpKey = mkPreludeMiscIdUnique 109
980 geClassOpKey = mkPreludeMiscIdUnique 110
981 negateClassOpKey = mkPreludeMiscIdUnique 111
982 failMClassOpKey = mkPreludeMiscIdUnique 112
983 bindMClassOpKey = mkPreludeMiscIdUnique 113 -- (>>=)
984 thenMClassOpKey = mkPreludeMiscIdUnique 114 -- (>>)
985 returnMClassOpKey = mkPreludeMiscIdUnique 117
987 -- Recursive do notation
988 mfixIdKey = mkPreludeMiscIdUnique 118
991 arrAIdKey = mkPreludeMiscIdUnique 119
992 composeAIdKey = mkPreludeMiscIdUnique 120 -- >>>
993 firstAIdKey = mkPreludeMiscIdUnique 121
994 appAIdKey = mkPreludeMiscIdUnique 122
995 choiceAIdKey = mkPreludeMiscIdUnique 123 -- |||
996 loopAIdKey = mkPreludeMiscIdUnique 124
998 ---------------- Template Haskell -------------------
999 -- USES IdUniques 200-399
1000 -----------------------------------------------------
1004 %************************************************************************
1006 \subsection{Standard groups of types}
1008 %************************************************************************
1021 %************************************************************************
1023 \subsection[Class-std-groups]{Standard groups of Prelude classes}
1025 %************************************************************************
1027 NOTE: @Eq@ and @Text@ do need to appear in @standardClasses@
1028 even though every numeric class has these two as a superclass,
1029 because the list of ambiguous dictionaries hasn't been simplified.
1037 ++ fractionalClassKeys
1039 fractionalClassKeys =
1040 [ fractionalClassKey
1046 -- the strictness analyser needs to know about numeric types
1047 -- (see SaAbsInt.lhs)
1048 needsDataDeclCtxtClassKeys = -- see comments in TcDeriv
1052 -- The "standard classes" are used in defaulting (Haskell 98 report 4.3.4),
1053 -- and are: "classes defined in the Prelude or a standard library"
1054 standardClassKeys = derivableClassKeys ++ numericClassKeys
1055 ++ [randomClassKey, randomGenClassKey,
1057 monadClassKey, monadPlusClassKey]
1060 @derivableClassKeys@ is also used in checking \tr{deriving} constructs
1065 = [ eqClassKey, ordClassKey, enumClassKey, ixClassKey,
1066 boundedClassKey, showClassKey, readClassKey ]