PrelNames.lhs 83.9 KB
Newer Older
1
2
3
%
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
4
5
6
\section[PrelNames]{Definitions of prelude modules and names}


7
Nota Bene: all Names defined in here should come from the base package
8

9
10
 - ModuleNames for prelude modules,
        e.g.    pREL_BASE_Name :: ModuleName
11

Thomas Schilling's avatar
Thomas Schilling committed
12
 - Modules for prelude modules
13
        e.g.    pREL_Base :: Module
14

15
 - Uniques for Ids, DataCons, TyCons and Classes that the compiler
Thomas Schilling's avatar
Thomas Schilling committed
16
   "knows about" in some way
17
18
        e.g.    intTyConKey :: Unique
                minusClassOpKey :: Unique
19

20
 - Names for Ids, DataCons, TyCons and Classes that the compiler
Thomas Schilling's avatar
Thomas Schilling committed
21
   "knows about" in some way
22
23
        e.g.    intTyConName :: Name
                minusName    :: Name
Thomas Schilling's avatar
Thomas Schilling committed
24
   One of these Names contains
25
26
        (a) the module and occurrence name of the thing
        (b) its Unique
Thomas Schilling's avatar
Thomas Schilling committed
27
28
29
30
31
   The may way the compiler "knows about" one of these things is
   where the type checker or desugarer needs to look it up. For
   example, when desugaring list comprehensions the desugarer
   needs to conjure up 'foldr'.  It does this by looking up
   foldrName in the environment.
32

Thomas Schilling's avatar
Thomas Schilling committed
33
34
35
 - RdrNames for Ids, DataCons etc that the compiler may emit into
   generated code (e.g. for deriving).  It's not necessary to know
   the uniques for these guys, only their names
36

37

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Note [Known-key names]
~~~~~~~~~~~~~~~~~~~~~~

It is *very* important that the compiler gives wired-in things and things with "known-key" names
the correct Uniques wherever they occur. We have to be careful about this in exactly two places:

  1. When we parse some source code, renaming the AST better yield an AST whose Names have the
     correct uniques

  2. When we read an interface file, the read-in gubbins better have the right uniques

This is accomplished through a combination of mechanisms:

  1. When parsing source code, the RdrName-decorated AST has some RdrNames which are Exact. These are
     wired-in RdrNames where the we could directly tell from the parsed syntax what Name to use. For
     example, when we parse a [] in a type we can just insert an Exact RdrName Name with the listTyConKey.

     Currently, I believe this is just an optimisation: it would be equally valid to just output Orig
     RdrNames that correctly record the module etc we expect the final Name to come from. However,
     were we to eliminate isTupleOcc_maybe it would become essential (see point 3).

  2. The knownKeyNames (which consist of the basicKnownKeyNames from the module, and those names reachable
     via the wired-in stuff from TysWiredIn) are used to initialise the "original name cache" in IfaceEnv.
     This initialization ensures that when the type checker or renamer (both of which use IfaceEnv) look up
     an original name (i.e. a pair of a Module and an OccName) for a known-key name they get the correct Unique.

     This is the most important mechanism for ensuring that known-key stuff gets the right Unique, and is why
     it is so important to place your known-key names in the appropriate lists.

  3. For "infinite families" of known-key names (i.e. tuples, Any tycons and implicit parameter TyCons), we
     have to be extra careful. Because there are an infinite number of these things, we cannot add them to
     the list of known-key names used to initialise the original name cache. Instead, we have to rely on
     never having to look them up in that cache.

     This is accomplished through a variety of mechanisms:

       a) The known infinite families of names are specially serialised by BinIface.putName, with that special treatment
          detected when we read back to ensure that we get back to the correct uniques.

       b) Most of the infinite families cannot occur in source code, so mechanism a) sufficies to ensure that they
          always have the right Unique. In particular, implicit param TyCon names, constraint tuples and Any TyCons
          cannot be mentioned by the user.

       c) Tuple TyCon/DataCon names have a special hack (isTupleOcc_maybe) that is used by the original name cache
          lookup routine to detect tuple names and give them the right Unique. You might think that this is unnecessary
          because tuple TyCon/DataCons are parsed as Exact RdrNames and *don't* appear as original names in interface files
          (because serialization gives them special treatment), so we will never look them up in the original name cache.

          However, there is a subtle reason why this is not the case: if you use setRdrNameSpace on an Exact RdrName
          it may be turned into an Orig RdrName. So if the original name was an Exact tuple Name we might end up with
          an Orig instead, which *will* lead to an original name cache query.
89
\begin{code}
90
module PrelNames (
91
92
93
94
95
96
97
98
        Unique, Uniquable(..), hasKey,  -- Re-exported for convenience

        -----------------------------------------------------------
        module PrelNames,       -- A huge bunch of (a) Names,  e.g. intTyConName
                                --                 (b) Uniques e.g. intTyConKey
                                --                 (c) Groups of classes and types
                                --                 (d) miscellaneous things
                                -- So many that we export them all
99
    ) where
100
101
102

#include "HsVersions.h"

103
import Module
Ian Lynagh's avatar
Ian Lynagh committed
104
import OccName
105
106
107
108
import RdrName
import Unique
import BasicTypes
import Name
109
import SrcLoc
110
import FastString
111
112
\end{code}

113

114
%************************************************************************
115
%*                                                                      *
116
\subsection{Local Names}
117
%*                                                                      *
118
119
120
121
122
%************************************************************************

This *local* name is used by the interactive stuff

\begin{code}
123
124
itName :: Unique -> SrcSpan -> Name
itName uniq loc = mkInternalName uniq (mkOccNameFS varName (fsLit "it")) loc
125
126
127
128
129
130
\end{code}

\begin{code}
-- mkUnboundName makes a place-holder Name; it shouldn't be looked at except possibly
-- during compiler debugging.
mkUnboundName :: RdrName -> Name
131
mkUnboundName rdr_name = mkInternalName unboundKey (rdrNameOcc rdr_name) noSrcSpan
132
133
134
135
136
137

isUnboundName :: Name -> Bool
isUnboundName name = name `hasKey` unboundKey
\end{code}


138
%************************************************************************
139
%*                                                                      *
140
\subsection{Known key Names}
141
%*                                                                      *
142
143
%************************************************************************

144
This section tells what the compiler knows about the association of
145
146
names with uniques.  These ones are the *non* wired-in ones.  The
wired in ones are defined in TysWiredIn etc.
147

148
The names for DPH can come from one of multiple backend packages. At the point where
149
150
151
152
153
'basicKnownKeyNames' is used, we don't know which backend it will be.  Hence, we list
the names for multiple backends.  That works out fine, although they use the same uniques,
as we are guaranteed to only load one backend; hence, only one of the different names
sharing a unique will be used.

154
\begin{code}
155
156
basicKnownKeyNames :: [Name]
basicKnownKeyNames
157
 = genericTyConNames
158
 ++ oldTypeableClassNames
159
160
161
162
163
164
165
 ++ [   -- Type constructors (synonyms especially)
        ioTyConName, ioDataConName,
        runMainIOName,
        rationalTyConName,
        stringTyConName,
        ratioDataConName,
        ratioTyConName,
166
        integerTyConName,
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186

        --  Classes.  *Must* include:
        --      classes that are grabbed by key (e.g., eqClassKey)
        --      classes in "Class.standardClassKeys" (quite a few)
        eqClassName,                    -- mentioned, derivable
        ordClassName,                   -- derivable
        boundedClassName,               -- derivable
        numClassName,                   -- mentioned, numeric
        enumClassName,                  -- derivable
        monadClassName,
        functorClassName,
        realClassName,                  -- numeric
        integralClassName,              -- numeric
        fractionalClassName,            -- numeric
        floatingClassName,              -- numeric
        realFracClassName,              -- numeric
        realFloatClassName,             -- numeric
        dataClassName,
        isStringClassName,
        applicativeClassName,
187
        alternativeClassName,
188
189
        foldableClassName,
        traversableClassName,
190
        typeableClassName,              -- derivable
191
192

        -- Numeric stuff
193
194
195
196
197
198
        negateName, minusName, geName, eqName,

        -- Conversion functions
        fromRationalName, fromIntegerName,
        toIntegerName, toRationalName,
        fromIntegralName, realToFracName,
199
200
201

        -- String stuff
        fromStringName,
202
203
204
205
206

        -- Enum stuff
        enumFromName, enumFromThenName,
        enumFromThenToName, enumFromToName,

207
208
209
210
        -- Applicative/Alternative stuff
        pureAName,
        apAName,

211
212
213
        -- Monad stuff
        thenIOName, bindIOName, returnIOName, failIOName,
        failMName, bindMName, thenMName, returnMName,
214
        fmapName,
215
        joinMName,
216

217
218
        -- MonadRec stuff
        mfixName,
219

220
221
222
        -- Arrow stuff
        arrAName, composeAName, firstAName,
        appAName, choiceAName, loopAName,
223

224
225
        -- Ix stuff
        ixClassName,
226

227
228
        -- Show stuff
        showClassName,
229

230
231
        -- Read stuff
        readClassName,
232

233
234
        -- Stable pointers
        newStablePtrName,
235

236
        -- GHC Extensions
237
        groupWithName,
238

239
240
241
        -- Strings and lists
        unpackCStringName,
        unpackCStringFoldrName, unpackCStringUtf8Name,
242

243
244
245
246
247
        -- Overloaded lists
        isListClassName,
        fromListName,
        fromListNName,
        toListName,
248

249
250
251
        -- List operations
        concatName, filterName, mapName,
        zipName, foldrName, buildName, augmentName, appendName,
252

253
        dollarName,         -- The ($) apply function
254

255
256
257
        -- FFI primitive types that are not wired-in.
        stablePtrTyConName, ptrTyConName, funPtrTyConName,
        int8TyConName, int16TyConName, int32TyConName, int64TyConName,
258
        word8TyConName, word16TyConName, word32TyConName, word64TyConName,
259

260
261
262
        -- Others
        otherwiseIdName, inlineIdName,
        eqStringName, assertName, breakpointName, breakpointCondName,
263
        breakpointAutoName,  opaqueTyConName,
David Himmelstrup's avatar
David Himmelstrup committed
264
        assertErrorName, runSTRepName,
265
        printName, fstName, sndName,
266

267
        -- Integer
268
        integerTyConName, mkIntegerName,
269
        integerToWord64Name, integerToInt64Name,
Ian Lynagh's avatar
Ian Lynagh committed
270
        word64ToIntegerName, int64ToIntegerName,
271
        plusIntegerName, timesIntegerName, smallIntegerName,
272
        wordToIntegerName,
273
        integerToWordName, integerToIntName, minusIntegerName,
274
        negateIntegerName, eqIntegerPrimName, neqIntegerPrimName,
275
        absIntegerName, signumIntegerName,
276
        leIntegerPrimName, gtIntegerPrimName, ltIntegerPrimName, geIntegerPrimName,
Ian Lynagh's avatar
Ian Lynagh committed
277
        compareIntegerName, quotRemIntegerName, divModIntegerName,
278
        quotIntegerName, remIntegerName, divIntegerName, modIntegerName,
279
        floatFromIntegerName, doubleFromIntegerName,
280
        encodeFloatIntegerName, encodeDoubleIntegerName,
Ian Lynagh's avatar
Ian Lynagh committed
281
        decodeDoubleIntegerName,
282
283
284
285
        gcdIntegerName, lcmIntegerName,
        andIntegerName, orIntegerName, xorIntegerName, complementIntegerName,
        shiftLIntegerName, shiftRIntegerName,

286
287
288
289
        -- Float/Double
        rationalToFloatName,
        rationalToDoubleName,

290
291
        -- MonadFix
        monadFixClassName, mfixName,
292

293
294
        -- Other classes
        randomClassName, randomGenClassName, monadPlusClassName,
295

296
        -- Type-level naturals
297
        singIClassName,
298

299
300
301
        -- Implicit parameters
        ipClassName,

302
        -- Annotation type checking
303
        toAnnotationWrapperName
304

305
306
307
        -- The Ordering type
        , orderingTyConName, ltDataConName, eqDataConName, gtDataConName

308
309
        -- The Either type
        , eitherTyConName, leftDataConName, rightDataConName
310

311
312
        -- Plugins
        , pluginTyConName
313
314
315
316
317
318
319
320
321

        -- dotnet interop
        , objectTyConName, marshalObjectName, unmarshalObjectName
        , marshalStringName, unmarshalStringName, checkDotnetResName

        -- Generics
        , genClassName, gen1ClassName
        , datatypeClassName, constructorClassName, selectorClassName

322
323
324
325
        -- Monad comprehensions
        , guardMName
        , liftMName
        , mzipName
dterei's avatar
dterei committed
326
327
328

        -- GHCi Sandbox
        , ghciIoClassName, ghciStepIoMName
329
    ]
330

331
genericTyConNames :: [Name]
332
333
334
335
336
337
genericTyConNames = [
    v1TyConName, u1TyConName, par1TyConName, rec1TyConName,
    k1TyConName, m1TyConName, sumTyConName, prodTyConName,
    compTyConName, rTyConName, pTyConName, dTyConName,
    cTyConName, sTyConName, rec0TyConName, par0TyConName,
    d1TyConName, c1TyConName, s1TyConName, noSelTyConName,
338
    repTyConName, rep1TyConName
339
  ]
340
341
342
\end{code}


343
%************************************************************************
344
%*                                                                      *
345
\subsection{Module names}
346
%*                                                                      *
347
348
%************************************************************************

349
350

--MetaHaskell Extension Add a new module here
351
\begin{code}
Ian Lynagh's avatar
Ian Lynagh committed
352
pRELUDE :: Module
353
pRELUDE         = mkBaseModule_ pRELUDE_NAME
Ian Lynagh's avatar
Ian Lynagh committed
354

355
gHC_PRIM, gHC_TYPES, gHC_GENERICS, gHC_MAGIC, gHC_COERCIBLE,
dterei's avatar
dterei committed
356
    gHC_CLASSES, gHC_BASE, gHC_ENUM, gHC_GHCI, gHC_CSTRING,
357
    gHC_SHOW, gHC_READ, gHC_NUM, gHC_INTEGER_TYPE, gHC_LIST,
358
    gHC_TUPLE, dATA_TUPLE, dATA_EITHER, dATA_STRING, dATA_FOLDABLE, dATA_TRAVERSABLE, dATA_MONOID,
dterei's avatar
dterei committed
359
360
    gHC_CONC, gHC_IO, gHC_IO_Exception,
    gHC_ST, gHC_ARR, gHC_STABLE, gHC_PTR, gHC_ERR, gHC_REAL,
361
362
    gHC_FLOAT, gHC_TOP_HANDLER, sYSTEM_IO, dYNAMIC,
    tYPEABLE, tYPEABLE_INTERNAL, oLDTYPEABLE, oLDTYPEABLE_INTERNAL, gENERICS,
363
    dOTNET, rEAD_PREC, lEX, gHC_INT, gHC_WORD, mONAD, mONAD_FIX, mONAD_ZIP,
364
    aRROW, cONTROL_APPLICATIVE, gHC_DESUGAR, rANDOM, gHC_EXTS,
365
    cONTROL_EXCEPTION_BASE, gHC_TYPELITS, gHC_IP :: Module
simonpj@microsoft.com's avatar
simonpj@microsoft.com committed
366

367
gHC_PRIM        = mkPrimModule (fsLit "GHC.Prim")   -- Primitive types and values
simonpj@microsoft.com's avatar
simonpj@microsoft.com committed
368
gHC_TYPES       = mkPrimModule (fsLit "GHC.Types")
369
370
371
gHC_MAGIC       = mkPrimModule (fsLit "GHC.Magic")
gHC_CSTRING     = mkPrimModule (fsLit "GHC.CString")
gHC_CLASSES     = mkPrimModule (fsLit "GHC.Classes")
372
gHC_COERCIBLE   = mkPrimModule (fsLit "GHC.Coercible")
373
374
375

gHC_BASE        = mkBaseModule (fsLit "GHC.Base")
gHC_ENUM        = mkBaseModule (fsLit "GHC.Enum")
dterei's avatar
dterei committed
376
gHC_GHCI        = mkBaseModule (fsLit "GHC.GHCi")
377
378
379
gHC_SHOW        = mkBaseModule (fsLit "GHC.Show")
gHC_READ        = mkBaseModule (fsLit "GHC.Read")
gHC_NUM         = mkBaseModule (fsLit "GHC.Num")
simonpj@microsoft.com's avatar
simonpj@microsoft.com committed
380
gHC_INTEGER_TYPE= mkIntegerModule (fsLit "GHC.Integer.Type")
381
382
383
gHC_LIST        = mkBaseModule (fsLit "GHC.List")
gHC_TUPLE       = mkPrimModule (fsLit "GHC.Tuple")
dATA_TUPLE      = mkBaseModule (fsLit "Data.Tuple")
384
385
386
dATA_EITHER     = mkBaseModule (fsLit "Data.Either")
dATA_STRING     = mkBaseModule (fsLit "Data.String")
dATA_FOLDABLE   = mkBaseModule (fsLit "Data.Foldable")
387
dATA_TRAVERSABLE= mkBaseModule (fsLit "Data.Traversable")
388
dATA_MONOID     = mkBaseModule (fsLit "Data.Monoid")
389
390
gHC_CONC        = mkBaseModule (fsLit "GHC.Conc")
gHC_IO          = mkBaseModule (fsLit "GHC.IO")
391
gHC_IO_Exception = mkBaseModule (fsLit "GHC.IO.Exception")
392
393
394
395
396
397
398
399
400
401
gHC_ST          = mkBaseModule (fsLit "GHC.ST")
gHC_ARR         = mkBaseModule (fsLit "GHC.Arr")
gHC_STABLE      = mkBaseModule (fsLit "GHC.Stable")
gHC_PTR         = mkBaseModule (fsLit "GHC.Ptr")
gHC_ERR         = mkBaseModule (fsLit "GHC.Err")
gHC_REAL        = mkBaseModule (fsLit "GHC.Real")
gHC_FLOAT       = mkBaseModule (fsLit "GHC.Float")
gHC_TOP_HANDLER = mkBaseModule (fsLit "GHC.TopHandler")
sYSTEM_IO       = mkBaseModule (fsLit "System.IO")
dYNAMIC         = mkBaseModule (fsLit "Data.Dynamic")
402
403
tYPEABLE        = mkBaseModule (fsLit "Data.Typeable")
tYPEABLE_INTERNAL = mkBaseModule (fsLit "Data.Typeable.Internal")
404
405
oLDTYPEABLE     = mkBaseModule (fsLit "Data.OldTypeable")
oLDTYPEABLE_INTERNAL = mkBaseModule (fsLit "Data.OldTypeable.Internal")
406
gENERICS        = mkBaseModule (fsLit "Data.Data")
407
408
409
410
411
412
413
dOTNET          = mkBaseModule (fsLit "GHC.Dotnet")
rEAD_PREC       = mkBaseModule (fsLit "Text.ParserCombinators.ReadPrec")
lEX             = mkBaseModule (fsLit "Text.Read.Lex")
gHC_INT         = mkBaseModule (fsLit "GHC.Int")
gHC_WORD        = mkBaseModule (fsLit "GHC.Word")
mONAD           = mkBaseModule (fsLit "Control.Monad")
mONAD_FIX       = mkBaseModule (fsLit "Control.Monad.Fix")
414
mONAD_ZIP       = mkBaseModule (fsLit "Control.Monad.Zip")
415
aRROW           = mkBaseModule (fsLit "Control.Arrow")
416
cONTROL_APPLICATIVE = mkBaseModule (fsLit "Control.Applicative")
Ian Lynagh's avatar
Ian Lynagh committed
417
gHC_DESUGAR = mkBaseModule (fsLit "GHC.Desugar")
418
419
rANDOM          = mkBaseModule (fsLit "System.Random")
gHC_EXTS        = mkBaseModule (fsLit "GHC.Exts")
420
cONTROL_EXCEPTION_BASE = mkBaseModule (fsLit "Control.Exception.Base")
jpm@cs.ox.ac.uk's avatar
jpm@cs.ox.ac.uk committed
421
gHC_GENERICS    = mkBaseModule (fsLit "GHC.Generics")
422
gHC_TYPELITS    = mkBaseModule (fsLit "GHC.TypeLits")
423
gHC_IP          = mkBaseModule (fsLit "GHC.IP")
Simon Marlow's avatar
Simon Marlow committed
424

425
426
427
gHC_PARR' :: Module
gHC_PARR' = mkBaseModule (fsLit "GHC.PArr")

Ian Lynagh's avatar
Ian Lynagh committed
428
mAIN, rOOT_MAIN :: Module
429
430
mAIN            = mkMainModule_ mAIN_NAME
rOOT_MAIN       = mkMainModule (fsLit ":Main") -- Root module for initialisation
Simon Marlow's avatar
Simon Marlow committed
431

432
433
434
435
        -- The ':xxx' makes a module name that the user can never
        -- use himself.  The z-encoding for ':' is "ZC", so the z-encoded
        -- module name still starts with a capital letter, which keeps
        -- the z-encoded version consistent.
436
iNTERACTIVE :: Module
Ian Lynagh's avatar
Ian Lynagh committed
437
iNTERACTIVE    = mkMainModule (fsLit ":Interactive")
Simon Marlow's avatar
Simon Marlow committed
438

Ian Lynagh's avatar
Ian Lynagh committed
439
pRELUDE_NAME, mAIN_NAME :: ModuleName
Ian Lynagh's avatar
Ian Lynagh committed
440
441
pRELUDE_NAME   = mkModuleNameFS (fsLit "Prelude")
mAIN_NAME      = mkModuleNameFS (fsLit "Main")
Simon Marlow's avatar
Simon Marlow committed
442

443
444
445
446
dATA_ARRAY_PARALLEL_NAME, dATA_ARRAY_PARALLEL_PRIM_NAME :: ModuleName
dATA_ARRAY_PARALLEL_NAME      = mkModuleNameFS (fsLit "Data.Array.Parallel")
dATA_ARRAY_PARALLEL_PRIM_NAME = mkModuleNameFS (fsLit "Data.Array.Parallel.Prim")

Ian Lynagh's avatar
Ian Lynagh committed
447
448
449
450
451
452
mkPrimModule :: FastString -> Module
mkPrimModule m = mkModule primPackageId (mkModuleNameFS m)

mkIntegerModule :: FastString -> Module
mkIntegerModule m = mkModule integerPackageId (mkModuleNameFS m)

Simon Marlow's avatar
Simon Marlow committed
453
454
455
456
457
458
mkBaseModule :: FastString -> Module
mkBaseModule m = mkModule basePackageId (mkModuleNameFS m)

mkBaseModule_ :: ModuleName -> Module
mkBaseModule_ m = mkModule basePackageId m

459
460
461
462
463
464
mkThisGhcModule :: FastString -> Module
mkThisGhcModule m = mkModule thisGhcPackageId (mkModuleNameFS m)

mkThisGhcModule_ :: ModuleName -> Module
mkThisGhcModule_ m = mkModule thisGhcPackageId m

Simon Marlow's avatar
Simon Marlow committed
465
466
mkMainModule :: FastString -> Module
mkMainModule m = mkModule mainPackageId (mkModuleNameFS m)
467

Simon Marlow's avatar
Simon Marlow committed
468
469
mkMainModule_ :: ModuleName -> Module
mkMainModule_ m = mkModule mainPackageId m
470
471
472
\end{code}

%************************************************************************
473
%*                                                                      *
474
\subsection{Constructing the names of tuples
475
%*                                                                      *
476
477
478
%************************************************************************

\begin{code}
batterseapower's avatar
batterseapower committed
479
480
mkTupleModule :: TupleSort -> Arity -> Module
mkTupleModule BoxedTuple   _ = gHC_TUPLE
481
mkTupleModule ConstraintTuple    _ = gHC_TUPLE
batterseapower's avatar
batterseapower committed
482
mkTupleModule UnboxedTuple _ = gHC_PRIM
483
484
485
\end{code}


486
%************************************************************************
487
488
489
%*                                                                      *
                        RdrNames
%*                                                                      *
490
491
492
%************************************************************************

\begin{code}
Ian Lynagh's avatar
Ian Lynagh committed
493
main_RDR_Unqual    :: RdrName
494
495
496
main_RDR_Unqual = mkUnqual varName (fsLit "main")
        -- We definitely don't want an Orig RdrName, because
        -- main might, in principle, be imported into module Main
497

498
forall_tv_RDR, dot_tv_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
499
500
forall_tv_RDR = mkUnqual tvName (fsLit "forall")
dot_tv_RDR    = mkUnqual tvName (fsLit ".")
501

Ian Lynagh's avatar
Ian Lynagh committed
502
503
eq_RDR, ge_RDR, ne_RDR, le_RDR, lt_RDR, gt_RDR, compare_RDR,
    ltTag_RDR, eqTag_RDR, gtTag_RDR :: RdrName
504
505
506
507
508
509
510
eq_RDR                  = nameRdrName eqName
ge_RDR                  = nameRdrName geName
ne_RDR                  = varQual_RDR  gHC_CLASSES (fsLit "/=")
le_RDR                  = varQual_RDR  gHC_CLASSES (fsLit "<=")
lt_RDR                  = varQual_RDR  gHC_CLASSES (fsLit "<")
gt_RDR                  = varQual_RDR  gHC_CLASSES (fsLit ">")
compare_RDR             = varQual_RDR  gHC_CLASSES (fsLit "compare")
Ian Lynagh's avatar
Ian Lynagh committed
511
512
513
ltTag_RDR               = dataQual_RDR gHC_TYPES (fsLit "LT")
eqTag_RDR               = dataQual_RDR gHC_TYPES (fsLit "EQ")
gtTag_RDR               = dataQual_RDR gHC_TYPES (fsLit "GT")
514

Ian Lynagh's avatar
Ian Lynagh committed
515
516
eqClass_RDR, numClass_RDR, ordClass_RDR, enumClass_RDR, monadClass_RDR
    :: RdrName
517
518
519
520
521
eqClass_RDR             = nameRdrName eqClassName
numClass_RDR            = nameRdrName numClassName
ordClass_RDR            = nameRdrName ordClassName
enumClass_RDR           = nameRdrName enumClassName
monadClass_RDR          = nameRdrName monadClassName
522

Ian Lynagh's avatar
Ian Lynagh committed
523
map_RDR, append_RDR :: RdrName
524
525
map_RDR                 = varQual_RDR gHC_BASE (fsLit "map")
append_RDR              = varQual_RDR gHC_BASE (fsLit "++")
526

Ian Lynagh's avatar
Ian Lynagh committed
527
foldr_RDR, build_RDR, returnM_RDR, bindM_RDR, failM_RDR :: RdrName
528
529
530
531
532
foldr_RDR               = nameRdrName foldrName
build_RDR               = nameRdrName buildName
returnM_RDR             = nameRdrName returnMName
bindM_RDR               = nameRdrName bindMName
failM_RDR               = nameRdrName failMName
533

Ian Lynagh's avatar
Ian Lynagh committed
534
left_RDR, right_RDR :: RdrName
535
536
left_RDR                = nameRdrName leftDataConName
right_RDR               = nameRdrName rightDataConName
537

Ian Lynagh's avatar
Ian Lynagh committed
538
fromEnum_RDR, toEnum_RDR :: RdrName
539
540
fromEnum_RDR            = varQual_RDR gHC_ENUM (fsLit "fromEnum")
toEnum_RDR              = varQual_RDR gHC_ENUM (fsLit "toEnum")
541

Ian Lynagh's avatar
Ian Lynagh committed
542
enumFrom_RDR, enumFromTo_RDR, enumFromThen_RDR, enumFromThenTo_RDR :: RdrName
543
544
545
546
enumFrom_RDR            = nameRdrName enumFromName
enumFromTo_RDR          = nameRdrName enumFromToName
enumFromThen_RDR        = nameRdrName enumFromThenName
enumFromThenTo_RDR      = nameRdrName enumFromThenToName
547

Ian Lynagh's avatar
Ian Lynagh committed
548
ratioDataCon_RDR, plusInteger_RDR, timesInteger_RDR :: RdrName
549
550
551
ratioDataCon_RDR        = nameRdrName ratioDataConName
plusInteger_RDR         = nameRdrName plusIntegerName
timesInteger_RDR        = nameRdrName timesIntegerName
552

Ian Lynagh's avatar
Ian Lynagh committed
553
ioDataCon_RDR :: RdrName
554
ioDataCon_RDR           = nameRdrName ioDataConName
555

Ian Lynagh's avatar
Ian Lynagh committed
556
557
eqString_RDR, unpackCString_RDR, unpackCStringFoldr_RDR,
    unpackCStringUtf8_RDR :: RdrName
558
559
560
561
eqString_RDR            = nameRdrName eqStringName
unpackCString_RDR       = nameRdrName unpackCStringName
unpackCStringFoldr_RDR  = nameRdrName unpackCStringFoldrName
unpackCStringUtf8_RDR   = nameRdrName unpackCStringUtf8Name
562

563
newStablePtr_RDR :: RdrName
564
newStablePtr_RDR        = nameRdrName newStablePtrName
565

Ian Lynagh's avatar
Ian Lynagh committed
566
bindIO_RDR, returnIO_RDR :: RdrName
567
568
bindIO_RDR              = nameRdrName bindIOName
returnIO_RDR            = nameRdrName returnIOName
569

Ian Lynagh's avatar
Ian Lynagh committed
570
fromInteger_RDR, fromRational_RDR, minus_RDR, times_RDR, plus_RDR :: RdrName
571
572
573
574
fromInteger_RDR         = nameRdrName fromIntegerName
fromRational_RDR        = nameRdrName fromRationalName
minus_RDR               = nameRdrName minusName
times_RDR               = varQual_RDR  gHC_NUM (fsLit "*")
Ian Lynagh's avatar
Ian Lynagh committed
575
plus_RDR                = varQual_RDR gHC_NUM (fsLit "+")
Simon Marlow's avatar
Simon Marlow committed
576

Ian Lynagh's avatar
Ian Lynagh committed
577
fromString_RDR :: RdrName
578
fromString_RDR          = nameRdrName fromStringName
579

580
581
582
583
584
fromList_RDR, fromListN_RDR, toList_RDR :: RdrName
fromList_RDR = nameRdrName fromListName
fromListN_RDR = nameRdrName fromListNName
toList_RDR = nameRdrName toListName

Ian Lynagh's avatar
Ian Lynagh committed
585
compose_RDR :: RdrName
586
compose_RDR             = varQual_RDR gHC_BASE (fsLit ".")
Simon Marlow's avatar
Simon Marlow committed
587

Ian Lynagh's avatar
Ian Lynagh committed
588
not_RDR, getTag_RDR, succ_RDR, pred_RDR, minBound_RDR, maxBound_RDR,
589
    and_RDR, range_RDR, inRange_RDR, index_RDR,
Ian Lynagh's avatar
Ian Lynagh committed
590
    unsafeIndex_RDR, unsafeRangeSize_RDR :: RdrName
591
592
593
594
and_RDR                 = varQual_RDR gHC_CLASSES (fsLit "&&")
not_RDR                 = varQual_RDR gHC_CLASSES (fsLit "not")
getTag_RDR              = varQual_RDR gHC_BASE (fsLit "getTag")
succ_RDR                = varQual_RDR gHC_ENUM (fsLit "succ")
Ian Lynagh's avatar
Ian Lynagh committed
595
596
597
598
599
pred_RDR                = varQual_RDR gHC_ENUM (fsLit "pred")
minBound_RDR            = varQual_RDR gHC_ENUM (fsLit "minBound")
maxBound_RDR            = varQual_RDR gHC_ENUM (fsLit "maxBound")
range_RDR               = varQual_RDR gHC_ARR (fsLit "range")
inRange_RDR             = varQual_RDR gHC_ARR (fsLit "inRange")
600
601
602
index_RDR               = varQual_RDR gHC_ARR (fsLit "index")
unsafeIndex_RDR         = varQual_RDR gHC_ARR (fsLit "unsafeIndex")
unsafeRangeSize_RDR     = varQual_RDR gHC_ARR (fsLit "unsafeRangeSize")
Simon Marlow's avatar
Simon Marlow committed
603

Ian Lynagh's avatar
Ian Lynagh committed
604
readList_RDR, readListDefault_RDR, readListPrec_RDR, readListPrecDefault_RDR,
605
    readPrec_RDR, parens_RDR, choose_RDR, lexP_RDR, expectP_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
606
607
608
609
610
611
612
613
readList_RDR            = varQual_RDR gHC_READ (fsLit "readList")
readListDefault_RDR     = varQual_RDR gHC_READ (fsLit "readListDefault")
readListPrec_RDR        = varQual_RDR gHC_READ (fsLit "readListPrec")
readListPrecDefault_RDR = varQual_RDR gHC_READ (fsLit "readListPrecDefault")
readPrec_RDR            = varQual_RDR gHC_READ (fsLit "readPrec")
parens_RDR              = varQual_RDR gHC_READ (fsLit "parens")
choose_RDR              = varQual_RDR gHC_READ (fsLit "choose")
lexP_RDR                = varQual_RDR gHC_READ (fsLit "lexP")
614
expectP_RDR             = varQual_RDR gHC_READ (fsLit "expectP")
615

Ian Lynagh's avatar
Ian Lynagh committed
616
punc_RDR, ident_RDR, symbol_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
617
618
619
punc_RDR                = dataQual_RDR lEX (fsLit "Punc")
ident_RDR               = dataQual_RDR lEX (fsLit "Ident")
symbol_RDR              = dataQual_RDR lEX (fsLit "Symbol")
620

621
step_RDR, alt_RDR, reset_RDR, prec_RDR, pfail_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
622
step_RDR                = varQual_RDR  rEAD_PREC (fsLit "step")
623
alt_RDR                 = varQual_RDR  rEAD_PREC (fsLit "+++")
Ian Lynagh's avatar
Ian Lynagh committed
624
625
reset_RDR               = varQual_RDR  rEAD_PREC (fsLit "reset")
prec_RDR                = varQual_RDR  rEAD_PREC (fsLit "prec")
626
pfail_RDR               = varQual_RDR  rEAD_PREC (fsLit "pfail")
627

Ian Lynagh's avatar
Ian Lynagh committed
628
629
showList_RDR, showList___RDR, showsPrec_RDR, showString_RDR,
    showSpace_RDR, showParen_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
630
631
showList_RDR            = varQual_RDR gHC_SHOW (fsLit "showList")
showList___RDR          = varQual_RDR gHC_SHOW (fsLit "showList__")
632
showsPrec_RDR           = varQual_RDR gHC_SHOW (fsLit "showsPrec")
Ian Lynagh's avatar
Ian Lynagh committed
633
showString_RDR          = varQual_RDR gHC_SHOW (fsLit "showString")
634
635
showSpace_RDR           = varQual_RDR gHC_SHOW (fsLit "showSpace")
showParen_RDR           = varQual_RDR gHC_SHOW (fsLit "showParen")
636

637
638
639
640
641
642
643
644
typeRep_RDR, mkTyCon_RDR, mkTyConApp_RDR,
    oldTypeOf_RDR, oldMkTyCon_RDR, oldMkTyConApp_RDR :: RdrName
typeRep_RDR       = varQual_RDR tYPEABLE_INTERNAL    (fsLit "typeRep")
mkTyCon_RDR       = varQual_RDR tYPEABLE_INTERNAL    (fsLit "mkTyCon")
mkTyConApp_RDR    = varQual_RDR tYPEABLE_INTERNAL    (fsLit "mkTyConApp")
oldTypeOf_RDR     = varQual_RDR oLDTYPEABLE_INTERNAL (fsLit "typeOf")
oldMkTyCon_RDR    = varQual_RDR oLDTYPEABLE_INTERNAL (fsLit "mkTyCon")
oldMkTyConApp_RDR = varQual_RDR oLDTYPEABLE_INTERNAL (fsLit "mkTyConApp")
645

Ian Lynagh's avatar
Ian Lynagh committed
646
undefined_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
647
undefined_RDR = varQual_RDR gHC_ERR (fsLit "undefined")
648

649
650
651
652
653
654
error_RDR :: RdrName
error_RDR = varQual_RDR gHC_ERR (fsLit "error")

-- Generics (constructors and functions)
u1DataCon_RDR, par1DataCon_RDR, rec1DataCon_RDR,
  k1DataCon_RDR, m1DataCon_RDR, l1DataCon_RDR, r1DataCon_RDR,
jpm@cs.ox.ac.uk's avatar
jpm@cs.ox.ac.uk committed
655
656
657
  prodDataCon_RDR, comp1DataCon_RDR,
  unPar1_RDR, unRec1_RDR, unK1_RDR, unComp1_RDR,
  from_RDR, from1_RDR, to_RDR, to1_RDR,
658
659
  datatypeName_RDR, moduleName_RDR, isNewtypeName_RDR,
  conName_RDR, conFixity_RDR, conIsRecord_RDR,
660
  noArityDataCon_RDR, arityDataCon_RDR, selName_RDR,
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
  prefixDataCon_RDR, infixDataCon_RDR, leftAssocDataCon_RDR,
  rightAssocDataCon_RDR, notAssocDataCon_RDR :: RdrName

u1DataCon_RDR    = dataQual_RDR gHC_GENERICS (fsLit "U1")
par1DataCon_RDR  = dataQual_RDR gHC_GENERICS (fsLit "Par1")
rec1DataCon_RDR  = dataQual_RDR gHC_GENERICS (fsLit "Rec1")
k1DataCon_RDR    = dataQual_RDR gHC_GENERICS (fsLit "K1")
m1DataCon_RDR    = dataQual_RDR gHC_GENERICS (fsLit "M1")

l1DataCon_RDR     = dataQual_RDR gHC_GENERICS (fsLit "L1")
r1DataCon_RDR     = dataQual_RDR gHC_GENERICS (fsLit "R1")

prodDataCon_RDR   = dataQual_RDR gHC_GENERICS (fsLit ":*:")
comp1DataCon_RDR  = dataQual_RDR gHC_GENERICS (fsLit "Comp1")

jpm@cs.ox.ac.uk's avatar
jpm@cs.ox.ac.uk committed
676
677
678
679
680
unPar1_RDR  = varQual_RDR gHC_GENERICS (fsLit "unPar1")
unRec1_RDR  = varQual_RDR gHC_GENERICS (fsLit "unRec1")
unK1_RDR    = varQual_RDR gHC_GENERICS (fsLit "unK1")
unComp1_RDR = varQual_RDR gHC_GENERICS (fsLit "unComp1")

681
from_RDR  = varQual_RDR gHC_GENERICS (fsLit "from")
682
from1_RDR = varQual_RDR gHC_GENERICS (fsLit "from1")
683
to_RDR    = varQual_RDR gHC_GENERICS (fsLit "to")
684
685
686
687
to1_RDR   = varQual_RDR gHC_GENERICS (fsLit "to1")

datatypeName_RDR  = varQual_RDR gHC_GENERICS (fsLit "datatypeName")
moduleName_RDR    = varQual_RDR gHC_GENERICS (fsLit "moduleName")
688
isNewtypeName_RDR = varQual_RDR gHC_GENERICS (fsLit "isNewtype")
689
690
691
692
693
694
695
696
697
698
699
700
701
702
selName_RDR       = varQual_RDR gHC_GENERICS (fsLit "selName")
conName_RDR       = varQual_RDR gHC_GENERICS (fsLit "conName")
conFixity_RDR     = varQual_RDR gHC_GENERICS (fsLit "conFixity")
conIsRecord_RDR   = varQual_RDR gHC_GENERICS (fsLit "conIsRecord")

noArityDataCon_RDR    = dataQual_RDR gHC_GENERICS (fsLit "NoArity")
arityDataCon_RDR      = dataQual_RDR gHC_GENERICS (fsLit "Arity")
prefixDataCon_RDR     = dataQual_RDR gHC_GENERICS (fsLit "Prefix")
infixDataCon_RDR      = dataQual_RDR gHC_GENERICS (fsLit "Infix")
leftAssocDataCon_RDR  = dataQual_RDR gHC_GENERICS (fsLit "LeftAssociative")
rightAssocDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "RightAssociative")
notAssocDataCon_RDR   = dataQual_RDR gHC_GENERICS (fsLit "NotAssociative")


703
704
fmap_RDR, pure_RDR, ap_RDR, foldable_foldr_RDR, foldMap_RDR,
    traverse_RDR, mempty_RDR, mappend_RDR :: RdrName
705
fmap_RDR                = varQual_RDR gHC_BASE (fsLit "fmap")
706
707
pure_RDR                = nameRdrName pureAName
ap_RDR                  = nameRdrName apAName
708
foldable_foldr_RDR      = varQual_RDR dATA_FOLDABLE       (fsLit "foldr")
709
foldMap_RDR             = varQual_RDR dATA_FOLDABLE       (fsLit "foldMap")
710
traverse_RDR            = varQual_RDR dATA_TRAVERSABLE    (fsLit "traverse")
711
712
mempty_RDR              = varQual_RDR dATA_MONOID         (fsLit "mempty")
mappend_RDR             = varQual_RDR dATA_MONOID         (fsLit "mappend")
713

714
----------------------
Ian Lynagh's avatar
Ian Lynagh committed
715
716
varQual_RDR, tcQual_RDR, clsQual_RDR, dataQual_RDR
    :: Module -> FastString -> RdrName
717
718
719
720
varQual_RDR  mod str = mkOrig mod (mkOccNameFS varName str)
tcQual_RDR   mod str = mkOrig mod (mkOccNameFS tcName str)
clsQual_RDR  mod str = mkOrig mod (mkOccNameFS clsName str)
dataQual_RDR mod str = mkOrig mod (mkOccNameFS dataName str)
721
\end{code}
722

723
%************************************************************************
724
%*                                                                      *
725
\subsection{Known-key names}
726
%*                                                                      *
727
728
%************************************************************************

729
Many of these Names are not really "built in", but some parts of the
730
731
compiler (notably the deriving mechanism) need to mention their names,
and it's convenient to write them all down in one place.
732

733
--MetaHaskell Extension  add the constrs and the lower case case
734
-- guys as well (perhaps) e.g. see  trueDataConName     below
735
736


737
\begin{code}
738
739
740
wildCardName :: Name
wildCardName = mkSystemVarName wildCardKey (fsLit "wild")

Ian Lynagh's avatar
Ian Lynagh committed
741
runMainIOName :: Name
Ian Lynagh's avatar
Ian Lynagh committed
742
runMainIOName = varQual gHC_TOP_HANDLER (fsLit "runMainIO") runMainKey
743

744
orderingTyConName, ltDataConName, eqDataConName, gtDataConName :: Name
Ian Lynagh's avatar
Ian Lynagh committed
745
746
747
748
orderingTyConName = tcQual   gHC_TYPES (fsLit "Ordering") orderingTyConKey
ltDataConName = conName gHC_TYPES (fsLit "LT") ltDataConKey
eqDataConName = conName gHC_TYPES (fsLit "EQ") eqDataConKey
gtDataConName = conName gHC_TYPES (fsLit "GT") gtDataConKey
Ian Lynagh's avatar
Ian Lynagh committed
749

Ian Lynagh's avatar
Ian Lynagh committed
750
eitherTyConName, leftDataConName, rightDataConName :: Name
751
eitherTyConName   = tcQual  dATA_EITHER (fsLit "Either") eitherTyConKey
Ian Lynagh's avatar
Ian Lynagh committed
752
753
leftDataConName   = conName dATA_EITHER (fsLit "Left")   leftDataConKey
rightDataConName  = conName dATA_EITHER (fsLit "Right")  rightDataConKey
754

755
756
757
-- Generics (types)
v1TyConName, u1TyConName, par1TyConName, rec1TyConName,
  k1TyConName, m1TyConName, sumTyConName, prodTyConName,
758
  compTyConName, rTyConName, pTyConName, dTyConName,
759
760
  cTyConName, sTyConName, rec0TyConName, par0TyConName,
  d1TyConName, c1TyConName, s1TyConName, noSelTyConName,
761
  repTyConName, rep1TyConName :: Name
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786

v1TyConName  = tcQual gHC_GENERICS (fsLit "V1") v1TyConKey
u1TyConName  = tcQual gHC_GENERICS (fsLit "U1") u1TyConKey
par1TyConName  = tcQual gHC_GENERICS (fsLit "Par1") par1TyConKey
rec1TyConName  = tcQual gHC_GENERICS (fsLit "Rec1") rec1TyConKey
k1TyConName  = tcQual gHC_GENERICS (fsLit "K1") k1TyConKey
m1TyConName  = tcQual gHC_GENERICS (fsLit "M1") m1TyConKey

sumTyConName    = tcQual gHC_GENERICS (fsLit ":+:") sumTyConKey
prodTyConName   = tcQual gHC_GENERICS (fsLit ":*:") prodTyConKey
compTyConName   = tcQual gHC_GENERICS (fsLit ":.:") compTyConKey

rTyConName  = tcQual gHC_GENERICS (fsLit "R") rTyConKey
pTyConName  = tcQual gHC_GENERICS (fsLit "P") pTyConKey
dTyConName  = tcQual gHC_GENERICS (fsLit "D") dTyConKey
cTyConName  = tcQual gHC_GENERICS (fsLit "C") cTyConKey
sTyConName  = tcQual gHC_GENERICS (fsLit "S") sTyConKey

rec0TyConName  = tcQual gHC_GENERICS (fsLit "Rec0") rec0TyConKey
par0TyConName  = tcQual gHC_GENERICS (fsLit "Par0") par0TyConKey
d1TyConName  = tcQual gHC_GENERICS (fsLit "D1") d1TyConKey
c1TyConName  = tcQual gHC_GENERICS (fsLit "C1") c1TyConKey
s1TyConName  = tcQual gHC_GENERICS (fsLit "S1") s1TyConKey
noSelTyConName = tcQual gHC_GENERICS (fsLit "NoSelector") noSelTyConKey

787
repTyConName  = tcQual gHC_GENERICS (fsLit "Rep")  repTyConKey
788
789
rep1TyConName = tcQual gHC_GENERICS (fsLit "Rep1") rep1TyConKey

790
-- Base strings Strings
Ian Lynagh's avatar
Ian Lynagh committed
791
unpackCStringName, unpackCStringFoldrName,
Ian Lynagh's avatar
Ian Lynagh committed
792
    unpackCStringUtf8Name, eqStringName, stringTyConName :: Name
793
794
795
unpackCStringName       = varQual gHC_CSTRING (fsLit "unpackCString#") unpackCStringIdKey
unpackCStringFoldrName  = varQual gHC_CSTRING (fsLit "unpackFoldrCString#") unpackCStringFoldrIdKey
unpackCStringUtf8Name   = varQual gHC_CSTRING (fsLit "unpackCStringUtf8#") unpackCStringUtf8IdKey
796
eqStringName            = varQual gHC_BASE (fsLit "eqString")  eqStringIdKey
Ian Lynagh's avatar
Ian Lynagh committed
797
stringTyConName         = tcQual  gHC_BASE (fsLit "String") stringTyConKey
798

799
-- The 'inline' function
Ian Lynagh's avatar
Ian Lynagh committed
800
inlineIdName :: Name
801
inlineIdName            = varQual gHC_MAGIC (fsLit "inline") inlineIdKey
802

803
-- Base classes (Eq, Ord, Functor)
804
fmapName, eqClassName, eqName, ordClassName, geName, functorClassName :: Name
805
806
807
808
eqClassName       = clsQual  gHC_CLASSES (fsLit "Eq")      eqClassKey
eqName            = methName gHC_CLASSES (fsLit "==")      eqClassOpKey
ordClassName      = clsQual  gHC_CLASSES (fsLit "Ord")     ordClassKey
geName            = methName gHC_CLASSES (fsLit ">=")      geClassOpKey
Ian Lynagh's avatar
Ian Lynagh committed
809
functorClassName  = clsQual  gHC_BASE (fsLit "Functor") functorClassKey
810
fmapName          = methName gHC_BASE (fsLit "fmap")    fmapClassOpKey
811
812

-- Class Monad
Ian Lynagh's avatar
Ian Lynagh committed
813
monadClassName, thenMName, bindMName, returnMName, failMName :: Name
814
815
816
817
818
monadClassName     = clsQual  gHC_BASE (fsLit "Monad")  monadClassKey
thenMName          = methName gHC_BASE (fsLit ">>")     thenMClassOpKey
bindMName          = methName gHC_BASE (fsLit ">>=")    bindMClassOpKey
returnMName        = methName gHC_BASE (fsLit "return") returnMClassOpKey
failMName          = methName gHC_BASE (fsLit "fail")   failMClassOpKey
819

820
821
822
823
824
825
-- Classes (Applicative, Foldable, Traversable)
applicativeClassName, foldableClassName, traversableClassName :: Name
applicativeClassName  = clsQual  cONTROL_APPLICATIVE (fsLit "Applicative") applicativeClassKey
foldableClassName     = clsQual  dATA_FOLDABLE       (fsLit "Foldable")    foldableClassKey
traversableClassName  = clsQual  dATA_TRAVERSABLE    (fsLit "Traversable") traversableClassKey

826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843


-- AMP additions

joinMName,  apAName, pureAName, alternativeClassName :: Name
joinMName            = methName mONAD               (fsLit "join")        joinMIdKey
apAName              = methName cONTROL_APPLICATIVE (fsLit "<*>")         apAClassOpKey
pureAName            = methName cONTROL_APPLICATIVE (fsLit "pure")        pureAClassOpKey
alternativeClassName = clsQual  cONTROL_APPLICATIVE (fsLit "Alternative") alternativeClassKey

joinMIdKey, apAClassOpKey, pureAClassOpKey, alternativeClassKey :: Unique
joinMIdKey          = mkPreludeMiscIdUnique 750
apAClassOpKey       = mkPreludeMiscIdUnique 751 -- <*>
pureAClassOpKey     = mkPreludeMiscIdUnique 752
alternativeClassKey = mkPreludeMiscIdUnique 753



844
-- Functions for GHC extensions
Ian Lynagh's avatar
Ian Lynagh committed
845
groupWithName :: Name
Ian Lynagh's avatar
Ian Lynagh committed
846
groupWithName = varQual gHC_EXTS (fsLit "groupWith") groupWithIdKey
847

848
-- Random PrelBase functions
Ian Lynagh's avatar
Ian Lynagh committed
849
fromStringName, otherwiseIdName, foldrName, buildName, augmentName,
850
    mapName, appendName, assertName,
Ian Lynagh's avatar
Ian Lynagh committed
851
    breakpointName, breakpointCondName, breakpointAutoName,
852
    dollarName, opaqueTyConName :: Name
Ian Lynagh's avatar
Ian Lynagh committed
853
854
fromStringName = methName dATA_STRING (fsLit "fromString") fromStringClassOpKey
otherwiseIdName   = varQual gHC_BASE (fsLit "otherwise")  otherwiseIdKey
855
856
857
foldrName         = varQual gHC_BASE (fsLit "foldr")      foldrIdKey
buildName         = varQual gHC_BASE (fsLit "build")      buildIdKey
augmentName       = varQual gHC_BASE (fsLit "augment")    augmentIdKey
858
mapName           = varQual gHC_BASE (fsLit "map")        mapIdKey
859
860
appendName        = varQual gHC_BASE (fsLit "++")         appendIdKey
dollarName        = varQual gHC_BASE (fsLit "$")          dollarIdKey
Ian Lynagh's avatar
Ian Lynagh committed
861
862
863
864
865
assertName        = varQual gHC_BASE (fsLit "assert")     assertIdKey
breakpointName    = varQual gHC_BASE (fsLit "breakpoint") breakpointIdKey
breakpointCondName= varQual gHC_BASE (fsLit "breakpointCond") breakpointCondIdKey
breakpointAutoName= varQual gHC_BASE (fsLit "breakpointAuto") breakpointAutoIdKey
opaqueTyConName   = tcQual  gHC_BASE (fsLit "Opaque")   opaqueTyConKey
mnislaih's avatar
mnislaih committed
866

Ian Lynagh's avatar
Ian Lynagh committed
867
breakpointJumpName :: Name
868
869
870
breakpointJumpName
    = mkInternalName
        breakpointJumpIdKey
Ian Lynagh's avatar
Ian Lynagh committed
871
        (mkOccNameFS varName (fsLit "breakpointJump"))
872
        noSrcSpan
Ian Lynagh's avatar
Ian Lynagh committed
873
breakpointCondJumpName :: Name
David Himmelstrup's avatar
David Himmelstrup committed
874
875
876
breakpointCondJumpName
    = mkInternalName
        breakpointCondJumpIdKey
Ian Lynagh's avatar
Ian Lynagh committed
877
        (mkOccNameFS varName (fsLit "breakpointCondJump"))
878
        noSrcSpan
Ian Lynagh's avatar
Ian Lynagh committed
879
breakpointAutoJumpName :: Name
mnislaih's avatar
mnislaih committed
880
881
882
breakpointAutoJumpName
    = mkInternalName
        breakpointAutoJumpIdKey
Ian Lynagh's avatar
Ian Lynagh committed
883
        (mkOccNameFS varName (fsLit "breakpointAutoJump"))
884
        noSrcSpan
885

886
-- PrelTup
Ian Lynagh's avatar
Ian Lynagh committed
887
fstName, sndName :: Name
888
889
fstName           = varQual dATA_TUPLE (fsLit "fst") fstIdKey
sndName           = varQual dATA_TUPLE (fsLit "snd") sndIdKey
890

891
-- Module GHC.Num
892
numClassName, fromIntegerName, minusName, negateName :: Name
893
numClassName      = clsQual  gHC_NUM (fsLit "Num") numClassKey
Ian Lynagh's avatar
Ian Lynagh committed
894
fromIntegerName   = methName gHC_NUM (fsLit "fromInteger") fromIntegerClassOpKey
895
896
minusName         = methName gHC_NUM (fsLit "-") minusClassOpKey
negateName        = methName gHC_NUM (fsLit "negate") negateClassOpKey
897

898
integerTyConName, mkIntegerName,
899
    integerToWord64Name, integerToInt64Name,
Ian Lynagh's avatar
Ian Lynagh committed
900
    word64ToIntegerName, int64ToIntegerName,
901
    plusIntegerName, timesIntegerName, smallIntegerName,
902
    wordToIntegerName,
903
    integerToWordName, integerToIntName, minusIntegerName,
904
    negateIntegerName, eqIntegerPrimName, neqIntegerPrimName,
905
    absIntegerName, signumIntegerName,
906
    leIntegerPrimName, gtIntegerPrimName, ltIntegerPrimName, geIntegerPrimName,
Ian Lynagh's avatar
Ian Lynagh committed
907
    compareIntegerName, quotRemIntegerName, divModIntegerName,
908
    quotIntegerName, remIntegerName, divIntegerName, modIntegerName,
909
    floatFromIntegerName, doubleFromIntegerName,
910
    encodeFloatIntegerName, encodeDoubleIntegerName,
Ian Lynagh's avatar
Ian Lynagh committed
911
    decodeDoubleIntegerName,
912
913
914
    gcdIntegerName, lcmIntegerName,
    andIntegerName, orIntegerName, xorIntegerName, complementIntegerName,
    shiftLIntegerName, shiftRIntegerName :: Name
915
916
integerTyConName      = tcQual  gHC_INTEGER_TYPE (fsLit "Integer")           integerTyConKey
mkIntegerName         = varQual gHC_INTEGER_TYPE (fsLit "mkInteger")         mkIntegerIdKey
917
918
integerToWord64Name   = varQual gHC_INTEGER_TYPE (fsLit "integerToWord64")   integerToWord64IdKey
integerToInt64Name    = varQual gHC_INTEGER_TYPE (fsLit "integerToInt64")    integerToInt64IdKey
Ian Lynagh's avatar
Ian Lynagh committed
919
920
word64ToIntegerName   = varQual gHC_INTEGER_TYPE (fsLit "word64ToInteger")   word64ToIntegerIdKey
int64ToIntegerName    = varQual gHC_INTEGER_TYPE (fsLit "int64ToInteger")    int64ToIntegerIdKey
921
922
923
plusIntegerName       = varQual gHC_INTEGER_TYPE (fsLit "plusInteger")       plusIntegerIdKey
timesIntegerName      = varQual gHC_INTEGER_TYPE (fsLit "timesInteger")      timesIntegerIdKey
smallIntegerName      = varQual gHC_INTEGER_TYPE (fsLit "smallInteger")      smallIntegerIdKey
924
wordToIntegerName     = varQual gHC_INTEGER_TYPE (fsLit "wordToInteger")     wordToIntegerIdKey
925
926
927
928
integerToWordName     = varQual gHC_INTEGER_TYPE (fsLit "integerToWord")     integerToWordIdKey
integerToIntName      = varQual gHC_INTEGER_TYPE (fsLit "integerToInt")      integerToIntIdKey
minusIntegerName      = varQual gHC_INTEGER_TYPE (fsLit "minusInteger")      minusIntegerIdKey
negateIntegerName     = varQual gHC_INTEGER_TYPE (fsLit "negateInteger")     negateIntegerIdKey
929
930
eqIntegerPrimName     = varQual gHC_INTEGER_TYPE (fsLit "eqInteger#")        eqIntegerPrimIdKey
neqIntegerPrimName    = varQual gHC_INTEGER_TYPE (fsLit "neqInteger#")       neqIntegerPrimIdKey
931
932
absIntegerName        = varQual gHC_INTEGER_TYPE (fsLit "absInteger")        absIntegerIdKey
signumIntegerName     = varQual gHC_INTEGER_TYPE (fsLit "signumInteger")     signumIntegerIdKey
933
934
935
936
leIntegerPrimName     = varQual gHC_INTEGER_TYPE (fsLit "leInteger#")        leIntegerPrimIdKey
gtIntegerPrimName     = varQual gHC_INTEGER_TYPE (fsLit "gtInteger#")        gtIntegerPrimIdKey
ltIntegerPrimName     = varQual gHC_INTEGER_TYPE (fsLit "ltInteger#")        ltIntegerPrimIdKey
geIntegerPrimName     = varQual gHC_INTEGER_TYPE (fsLit "geInteger#")        geIntegerPrimIdKey
937
compareIntegerName    = varQual gHC_INTEGER_TYPE (fsLit "compareInteger")    compareIntegerIdKey
Ian Lynagh's avatar
Ian Lynagh committed
938
939
quotRemIntegerName    = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger")    quotRemIntegerIdKey
divModIntegerName     = varQual gHC_INTEGER_TYPE (fsLit "divModInteger")     divModIntegerIdKey
940
941
quotIntegerName       = varQual gHC_INTEGER_TYPE (fsLit "quotInteger")       quotIntegerIdKey
remIntegerName        = varQual gHC_INTEGER_TYPE (fsLit "remInteger")        remIntegerIdKey
942
943
divIntegerName        = varQual gHC_INTEGER_TYPE (fsLit "divInteger")        divIntegerIdKey
modIntegerName        = varQual gHC_INTEGER_TYPE (fsLit "modInteger")        modIntegerIdKey
944
945
946
947
floatFromIntegerName  = varQual gHC_INTEGER_TYPE (fsLit "floatFromInteger")      floatFromIntegerIdKey
doubleFromIntegerName = varQual gHC_INTEGER_TYPE (fsLit "doubleFromInteger")     doubleFromIntegerIdKey
encodeFloatIntegerName  = varQual gHC_INTEGER_TYPE (fsLit "encodeFloatInteger")  encodeFloatIntegerIdKey
encodeDoubleIntegerName = varQual gHC_INTEGER_TYPE (fsLit "encodeDoubleInteger") encodeDoubleIntegerIdKey
Ian Lynagh's avatar
Ian Lynagh committed
948
decodeDoubleIntegerName = varQual gHC_INTEGER_TYPE (fsLit "decodeDoubleInteger") decodeDoubleIntegerIdKey
949
950
951
952
953
954
955
956
gcdIntegerName        = varQual gHC_INTEGER_TYPE (fsLit "gcdInteger")        gcdIntegerIdKey
lcmIntegerName        = varQual gHC_INTEGER_TYPE (fsLit "lcmInteger")        lcmIntegerIdKey
andIntegerName        = varQual gHC_INTEGER_TYPE (fsLit "andInteger")        andIntegerIdKey
orIntegerName         = varQual gHC_INTEGER_TYPE (fsLit "orInteger")         orIntegerIdKey
xorIntegerName        = varQual gHC_INTEGER_TYPE (fsLit "xorInteger")        xorIntegerIdKey
complementIntegerName = varQual gHC_INTEGER_TYPE (fsLit "complementInteger") complementIntegerIdKey
shiftLIntegerName     = varQual gHC_INTEGER_TYPE (fsLit "shiftLInteger")     shiftLIntegerIdKey
shiftRIntegerName     = varQual gHC_INTEGER_TYPE (fsLit "shiftRInteger")     shiftRIntegerIdKey
957

958
-- GHC.Real types and classes
Ian Lynagh's avatar
Ian Lynagh committed
959
960
rationalTyConName, ratioTyConName, ratioDataConName, realClassName,
    integralClassName, realFracClassName, fractionalClassName,
961
962
    fromRationalName, toIntegerName, toRationalName, fromIntegralName,
    realToFracName :: Name
Ian Lynagh's avatar
Ian Lynagh committed
963
rationalTyConName   = tcQual  gHC_REAL (fsLit "Rational") rationalTyConKey
964
ratioTyConName      = tcQual  gHC_REAL (fsLit "Ratio") ratioTyConKey
Ian Lynagh's avatar
Ian Lynagh committed
965
ratioDataConName    = conName gHC_REAL (fsLit ":%") ratioDataConKey
966
realClassName       = clsQual gHC_REAL (fsLit "Real") realClassKey
Ian Lynagh's avatar
Ian Lynagh committed
967
968
969
integralClassName   = clsQual gHC_REAL (fsLit "Integral") integralClassKey
realFracClassName   = clsQual gHC_REAL (fsLit "RealFrac") realFracClassKey
fractionalClassName = clsQual gHC_REAL (fsLit "Fractional") fractionalClassKey
970
971
972
973
974
fromRationalName    = methName gHC_REAL (fsLit "fromRational") fromRationalClassOpKey
toIntegerName       = methName gHC_REAL (fsLit "toInteger") toIntegerClassOpKey
toRationalName      = methName gHC_REAL (fsLit "toRational") toRationalClassOpKey
fromIntegralName    = varQual  gHC_REAL (fsLit "fromIntegral") fromIntegralIdKey
realToFracName      = varQual  gHC_REAL (fsLit "realToFrac") realToFracIdKey
975
976

-- PrelFloat classes
Ian Lynagh's avatar
Ian Lynagh committed
977
floatingClassName, realFloatClassName :: Name
Ian Lynagh's avatar
Ian Lynagh committed
978
979
floatingClassName  = clsQual  gHC_FLOAT (fsLit "Floating") floatingClassKey
realFloatClassName = clsQual  gHC_FLOAT (fsLit "RealFloat") realFloatClassKey
980

981
982
983
984
985
-- other GHC.Float functions
rationalToFloatName, rationalToDoubleName :: Name
rationalToFloatName  = varQual gHC_FLOAT (fsLit "rationalToFloat") rationalToFloatIdKey
rationalToDoubleName = varQual gHC_FLOAT (fsLit "rationalToDouble") rationalToDoubleIdKey

986
-- Class Ix
Ian Lynagh's avatar
Ian Lynagh committed
987
ixClassName :: Name
Ian Lynagh's avatar
Ian Lynagh committed
988
ixClassName = clsQual gHC_ARR (fsLit "Ix") ixClassKey
989

990
-- Class Typeable
991
992
993
994
995
996
997
998
999
1000
typeableClassName,
    oldTypeableClassName, oldTypeable1ClassName, oldTypeable2ClassName,
    oldTypeable3ClassName, oldTypeable4ClassName, oldTypeable5ClassName,
    oldTypeable6ClassName, oldTypeable7ClassName :: Name
typeableClassName  = clsQual tYPEABLE_INTERNAL (fsLit "Typeable")  typeableClassKey
oldTypeableClassName  = clsQual oLDTYPEABLE_INTERNAL (fsLit "Typeable")  oldTypeableClassKey
oldTypeable1ClassName = clsQual oLDTYPEABLE_INTERNAL (fsLit "Typeable1") oldTypeable1ClassKey
oldTypeable2ClassName = clsQual oLDTYPEABLE_INTERNAL (fsLit "Typeable2") oldTypeable2ClassKey
oldTypeable3ClassName = clsQual oLDTYPEABLE_INTERNAL (fsLit "Typeable3") oldTypeable3ClassKey
oldTypeable4ClassName = clsQual oLDTYPEABLE_INTERNAL (fsLit "Typeable4") oldTypeable4ClassKey
For faster browsing, not all history is shown. View entire blame