PrelNames.hs 96.8 KB
Newer Older
Austin Seipp's avatar
Austin Seipp committed
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
Note [Known-key names]
~~~~~~~~~~~~~~~~~~~~~~
40
41
42
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:
43

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

47
48
  2. When we read an interface file, the read-in gubbins better have
     the right uniques
49
50
51

This is accomplished through a combination of mechanisms:

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
  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 isBuiltInOcc_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 "OrigNameCache" 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), 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 OrigNameCache. Instead, we have to
     rely on never having to look them up in that cache.
81

82
     This is accomplished through a variety of mechanisms:
83

84
       a) The parser recognises them specially and generates an
85
          Exact Name (hence not looked up in the orig-name cache)
86

87
88
89
90
       b) 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.
91

92
93
94
95
96
       Most of the infinite families cannot occur in source code,
       so mechanisms (a,b) 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.
97

98
99
100
       c) IfaceEnv.lookupOrigNameCache uses isBuiltInOcc_maybe to map
          built-in syntax directly onto the corresponding name, rather
          than trying to find it in the original-name cache.
101

102
          See also Note [Built-in syntax and the OrigNameCache]
Austin Seipp's avatar
Austin Seipp committed
103
-}
104

105
106
{-# LANGUAGE CPP #-}

107
module PrelNames (
108
109
110
111
112
113
114
115
        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
116
    ) where
117
118
119

#include "HsVersions.h"

120
import Module
Ian Lynagh's avatar
Ian Lynagh committed
121
import OccName
122
123
124
import RdrName
import Unique
import Name
125
import SrcLoc
126
import FastString
127
128
import Config ( cIntegerLibraryType, IntegerLibrary(..) )
import Panic ( panic )
129

Austin Seipp's avatar
Austin Seipp committed
130
131
132
{-
************************************************************************
*                                                                      *
133
     allNameStrings
Austin Seipp's avatar
Austin Seipp committed
134
135
136
*                                                                      *
************************************************************************
-}
137
138
139

allNameStrings :: [String]
-- Infinite list of a,b,c...z, aa, ab, ac, ... etc
140
allNameStrings = [ c:cs | cs <- "" : allNameStrings, c <- ['a'..'z'] ]
141

Austin Seipp's avatar
Austin Seipp committed
142
143
144
{-
************************************************************************
*                                                                      *
145
\subsection{Local Names}
Austin Seipp's avatar
Austin Seipp committed
146
147
*                                                                      *
************************************************************************
148
149

This *local* name is used by the interactive stuff
Austin Seipp's avatar
Austin Seipp committed
150
-}
151

152
153
itName :: Unique -> SrcSpan -> Name
itName uniq loc = mkInternalName uniq (mkOccNameFS varName (fsLit "it")) loc
154
155
156

-- mkUnboundName makes a place-holder Name; it shouldn't be looked at except possibly
-- during compiler debugging.
157
158
mkUnboundName :: OccName -> Name
mkUnboundName occ = mkInternalName unboundKey occ noSrcSpan
159
160
161
162

isUnboundName :: Name -> Bool
isUnboundName name = name `hasKey` unboundKey

Austin Seipp's avatar
Austin Seipp committed
163
164
165
{-
************************************************************************
*                                                                      *
166
\subsection{Known key Names}
Austin Seipp's avatar
Austin Seipp committed
167
168
*                                                                      *
************************************************************************
169

170
This section tells what the compiler knows about the association of
171
172
names with uniques.  These ones are the *non* wired-in ones.  The
wired in ones are defined in TysWiredIn etc.
Austin Seipp's avatar
Austin Seipp committed
173
-}
174

175
176
basicKnownKeyNames :: [Name]
basicKnownKeyNames
177
 = genericTyConNames
Ben Gamari's avatar
Ben Gamari committed
178
 ++ [   --  Classes.  *Must* include:
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
        --      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,
197
        alternativeClassName,
198
199
        foldableClassName,
        traversableClassName,
200
201
        semigroupClassName, sappendName,
        monoidClassName, memptyName, mappendName, mconcatName,
202

Ben Gamari's avatar
Ben Gamari committed
203
204
205
206
207
        -- The IO type
        -- See Note [TyConRepNames for non-wired-in TyCons]
        ioTyConName, ioDataConName,
        runMainIOName,

208
209
210
        -- Typeable
        typeableClassName,
        typeRepTyConName,
211
212
213
214
        trTyConDataConName,
        trModuleDataConName,
        trNameSDataConName,
        typeRepIdName,
215
216
        mkPolyTyConAppName,
        mkAppTyName,
217
        typeSymbolTypeRepName, typeNatTypeRepName,
218

219
220
        -- Dynamic
        toDynName,
221
222

        -- Numeric stuff
223
224
225
        negateName, minusName, geName, eqName,

        -- Conversion functions
Ben Gamari's avatar
Ben Gamari committed
226
227
        rationalTyConName,
        ratioTyConName, ratioDataConName,
228
229
230
        fromRationalName, fromIntegerName,
        toIntegerName, toRationalName,
        fromIntegralName, realToFracName,
231
232
233

        -- String stuff
        fromStringName,
234
235
236
237
238

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

239
240
        -- Applicative stuff
        pureAName, apAName, thenAName,
241

242
        -- Monad stuff
quchen's avatar
quchen committed
243
244
245
246
247
        thenIOName, bindIOName, returnIOName, failIOName, bindMName, thenMName,
        returnMName, fmapName, joinMName,

        -- MonadFail
        monadFailClassName, failMName, failMName_preMFP,
248

249
250
        -- MonadFix
        monadFixClassName, mfixName,
251

252
253
254
        -- Arrow stuff
        arrAName, composeAName, firstAName,
        appAName, choiceAName, loopAName,
255

256
257
        -- Ix stuff
        ixClassName,
258

259
260
        -- Show stuff
        showClassName,
261

262
263
        -- Read stuff
        readClassName,
264

265
266
        -- Stable pointers
        newStablePtrName,
267

268
        -- GHC Extensions
269
        groupWithName,
270

271
272
273
        -- Strings and lists
        unpackCStringName,
        unpackCStringFoldrName, unpackCStringUtf8Name,
274

275
276
277
278
279
        -- Overloaded lists
        isListClassName,
        fromListName,
        fromListNName,
        toListName,
280

281
282
283
        -- List operations
        concatName, filterName, mapName,
        zipName, foldrName, buildName, augmentName, appendName,
284

285
286
287
        -- FFI primitive types that are not wired-in.
        stablePtrTyConName, ptrTyConName, funPtrTyConName,
        int8TyConName, int16TyConName, int32TyConName, int64TyConName,
288
        word16TyConName, word32TyConName, word64TyConName,
289

290
291
292
        -- Others
        otherwiseIdName, inlineIdName,
        eqStringName, assertName, breakpointName, breakpointCondName,
293
        breakpointAutoName,  opaqueTyConName,
rwbarton's avatar
rwbarton committed
294
        assertErrorName,
295
        printName, fstName, sndName,
296

297
        -- Integer
298
        integerTyConName, mkIntegerName,
299
        integerToWord64Name, integerToInt64Name,
Ian Lynagh's avatar
Ian Lynagh committed
300
        word64ToIntegerName, int64ToIntegerName,
301
        plusIntegerName, timesIntegerName, smallIntegerName,
302
        wordToIntegerName,
303
        integerToWordName, integerToIntName, minusIntegerName,
304
        negateIntegerName, eqIntegerPrimName, neqIntegerPrimName,
305
        absIntegerName, signumIntegerName,
306
        leIntegerPrimName, gtIntegerPrimName, ltIntegerPrimName, geIntegerPrimName,
Ian Lynagh's avatar
Ian Lynagh committed
307
        compareIntegerName, quotRemIntegerName, divModIntegerName,
308
        quotIntegerName, remIntegerName, divIntegerName, modIntegerName,
309
        floatFromIntegerName, doubleFromIntegerName,
310
        encodeFloatIntegerName, encodeDoubleIntegerName,
Ian Lynagh's avatar
Ian Lynagh committed
311
        decodeDoubleIntegerName,
312
313
        gcdIntegerName, lcmIntegerName,
        andIntegerName, orIntegerName, xorIntegerName, complementIntegerName,
314
        shiftLIntegerName, shiftRIntegerName, bitIntegerName,
315

316
317
318
319
        -- Float/Double
        rationalToFloatName,
        rationalToDoubleName,

320
321
        -- Other classes
        randomClassName, randomGenClassName, monadPlusClassName,
322

323
        -- Type-level naturals
324
        knownNatClassName, knownSymbolClassName,
325

Adam Gundry's avatar
Adam Gundry committed
326
327
328
        -- Overloaded labels
        isLabelClassName,

329
330
331
332
333
        -- Implicit Parameters
        ipClassName,

        -- Call Stacks
        callStackTyConName,
Eric Seidel's avatar
Eric Seidel committed
334
        emptyCallStackName, pushCallStackName,
335
336

        -- Source Locations
337
338
        srcLocDataConName,

339
        -- Annotation type checking
340
        toAnnotationWrapperName
341

342
        -- The Ordering type
Ben Gamari's avatar
Ben Gamari committed
343
344
        , orderingTyConName
        , ltDataConName, eqDataConName, gtDataConName
345

346
347
348
        -- The SPEC type for SpecConstr
        , specTyConName

349
350
        -- The Either type
        , eitherTyConName, leftDataConName, rightDataConName
351

352
353
        -- Plugins
        , pluginTyConName
Edward Z. Yang's avatar
Edward Z. Yang committed
354
        , frontendPluginTyConName
355
356
357
358
359

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

360
361
362
363
        -- Monad comprehensions
        , guardMName
        , liftMName
        , mzipName
dterei's avatar
dterei committed
364
365
366

        -- GHCi Sandbox
        , ghciIoClassName, ghciStepIoMName
Facundo Domínguez's avatar
Facundo Domínguez committed
367
368
369
370
371
372
373
374

        -- StaticPtr
        , staticPtrTyConName
        , staticPtrDataConName, staticPtrInfoDataConName

        -- Fingerprint
        , fingerprintDataConName

375
376
377
378
379
380
381
        -- Custom type errors
        , errorMessageTypeErrorFamName
        , typeErrorTextDataConName
        , typeErrorAppendDataConName
        , typeErrorVAppendDataConName
        , typeErrorShowTypeDataConName

382
383
384
        -- homogeneous equality
        , eqTyConName

385
386
387
    ] ++ case cIntegerLibraryType of
           IntegerGMP    -> [integerSDataConName]
           IntegerSimple -> []
388

389
genericTyConNames :: [Name]
390
391
392
genericTyConNames = [
    v1TyConName, u1TyConName, par1TyConName, rec1TyConName,
    k1TyConName, m1TyConName, sumTyConName, prodTyConName,
393
394
    compTyConName, rTyConName, dTyConName,
    cTyConName, sTyConName, rec0TyConName,
395
    d1TyConName, c1TyConName, s1TyConName, noSelTyConName,
396
397
    repTyConName, rep1TyConName, uRecTyConName,
    uAddrTyConName, uCharTyConName, uDoubleTyConName,
398
399
400
    uFloatTyConName, uIntTyConName, uWordTyConName,
    prefixIDataConName, infixIDataConName, leftAssociativeDataConName,
    rightAssociativeDataConName, notAssociativeDataConName,
401
402
403
404
405
    sourceUnpackDataConName, sourceNoUnpackDataConName,
    noSourceUnpackednessDataConName, sourceLazyDataConName,
    sourceStrictDataConName, noSourceStrictnessDataConName,
    decidedLazyDataConName, decidedStrictDataConName, decidedUnpackDataConName,
    metaDataDataConName, metaConsDataConName, metaSelDataConName
406
  ]
407

Austin Seipp's avatar
Austin Seipp committed
408
409
410
{-
************************************************************************
*                                                                      *
411
\subsection{Module names}
Austin Seipp's avatar
Austin Seipp committed
412
413
*                                                                      *
************************************************************************
414

415
416

--MetaHaskell Extension Add a new module here
Austin Seipp's avatar
Austin Seipp committed
417
418
-}

Ian Lynagh's avatar
Ian Lynagh committed
419
pRELUDE :: Module
420
pRELUDE         = mkBaseModule_ pRELUDE_NAME
Ian Lynagh's avatar
Ian Lynagh committed
421

Joachim Breitner's avatar
Joachim Breitner committed
422
gHC_PRIM, gHC_TYPES, gHC_GENERICS, gHC_MAGIC,
dterei's avatar
dterei committed
423
    gHC_CLASSES, gHC_BASE, gHC_ENUM, gHC_GHCI, gHC_CSTRING,
424
    gHC_SHOW, gHC_READ, gHC_NUM, gHC_INTEGER_TYPE, gHC_LIST,
425
426
    gHC_TUPLE, dATA_TUPLE, dATA_EITHER, dATA_STRING,
    dATA_FOLDABLE, dATA_TRAVERSABLE, dATA_MONOID, dATA_SEMIGROUP,
dterei's avatar
dterei committed
427
428
    gHC_CONC, gHC_IO, gHC_IO_Exception,
    gHC_ST, gHC_ARR, gHC_STABLE, gHC_PTR, gHC_ERR, gHC_REAL,
429
    gHC_FLOAT, gHC_TOP_HANDLER, sYSTEM_IO, dYNAMIC,
430
    tYPEABLE, tYPEABLE_INTERNAL, gENERICS,
quchen's avatar
quchen committed
431
    rEAD_PREC, lEX, gHC_INT, gHC_WORD, mONAD, mONAD_FIX, mONAD_ZIP, mONAD_FAIL,
432
    aRROW, cONTROL_APPLICATIVE, gHC_DESUGAR, rANDOM, gHC_EXTS,
433
434
    cONTROL_EXCEPTION_BASE, gHC_TYPELITS, dATA_TYPE_EQUALITY,
    dATA_COERCE :: Module
simonpj@microsoft.com's avatar
simonpj@microsoft.com committed
435

436
gHC_PRIM        = mkPrimModule (fsLit "GHC.Prim")   -- Primitive types and values
simonpj@microsoft.com's avatar
simonpj@microsoft.com committed
437
gHC_TYPES       = mkPrimModule (fsLit "GHC.Types")
438
439
440
441
442
443
gHC_MAGIC       = mkPrimModule (fsLit "GHC.Magic")
gHC_CSTRING     = mkPrimModule (fsLit "GHC.CString")
gHC_CLASSES     = mkPrimModule (fsLit "GHC.Classes")

gHC_BASE        = mkBaseModule (fsLit "GHC.Base")
gHC_ENUM        = mkBaseModule (fsLit "GHC.Enum")
dterei's avatar
dterei committed
444
gHC_GHCI        = mkBaseModule (fsLit "GHC.GHCi")
445
446
447
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
448
gHC_INTEGER_TYPE= mkIntegerModule (fsLit "GHC.Integer.Type")
449
450
451
gHC_LIST        = mkBaseModule (fsLit "GHC.List")
gHC_TUPLE       = mkPrimModule (fsLit "GHC.Tuple")
dATA_TUPLE      = mkBaseModule (fsLit "Data.Tuple")
452
453
454
dATA_EITHER     = mkBaseModule (fsLit "Data.Either")
dATA_STRING     = mkBaseModule (fsLit "Data.String")
dATA_FOLDABLE   = mkBaseModule (fsLit "Data.Foldable")
455
dATA_TRAVERSABLE= mkBaseModule (fsLit "Data.Traversable")
456
dATA_SEMIGROUP  = mkBaseModule (fsLit "Data.Semigroup")
457
dATA_MONOID     = mkBaseModule (fsLit "Data.Monoid")
458
459
gHC_CONC        = mkBaseModule (fsLit "GHC.Conc")
gHC_IO          = mkBaseModule (fsLit "GHC.IO")
460
gHC_IO_Exception = mkBaseModule (fsLit "GHC.IO.Exception")
461
462
463
464
465
466
467
468
469
470
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")
471
472
tYPEABLE        = mkBaseModule (fsLit "Data.Typeable")
tYPEABLE_INTERNAL = mkBaseModule (fsLit "Data.Typeable.Internal")
473
gENERICS        = mkBaseModule (fsLit "Data.Data")
474
475
476
477
478
479
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")
480
mONAD_ZIP       = mkBaseModule (fsLit "Control.Monad.Zip")
quchen's avatar
quchen committed
481
mONAD_FAIL      = mkBaseModule (fsLit "Control.Monad.Fail")
482
aRROW           = mkBaseModule (fsLit "Control.Arrow")
483
cONTROL_APPLICATIVE = mkBaseModule (fsLit "Control.Applicative")
Ian Lynagh's avatar
Ian Lynagh committed
484
gHC_DESUGAR = mkBaseModule (fsLit "GHC.Desugar")
485
486
rANDOM          = mkBaseModule (fsLit "System.Random")
gHC_EXTS        = mkBaseModule (fsLit "GHC.Exts")
487
cONTROL_EXCEPTION_BASE = mkBaseModule (fsLit "Control.Exception.Base")
jpm@cs.ox.ac.uk's avatar
jpm@cs.ox.ac.uk committed
488
gHC_GENERICS    = mkBaseModule (fsLit "GHC.Generics")
489
gHC_TYPELITS    = mkBaseModule (fsLit "GHC.TypeLits")
490
491
dATA_TYPE_EQUALITY = mkBaseModule (fsLit "Data.Type.Equality")
dATA_COERCE     = mkBaseModule (fsLit "Data.Coerce")
Simon Marlow's avatar
Simon Marlow committed
492

493
494
495
gHC_PARR' :: Module
gHC_PARR' = mkBaseModule (fsLit "GHC.PArr")

496
497
498
gHC_SRCLOC :: Module
gHC_SRCLOC = mkBaseModule (fsLit "GHC.SrcLoc")

Ben Gamari's avatar
Ben Gamari committed
499
gHC_STACK, gHC_STACK_TYPES :: Module
500
gHC_STACK = mkBaseModule (fsLit "GHC.Stack")
Ben Gamari's avatar
Ben Gamari committed
501
gHC_STACK_TYPES = mkBaseModule (fsLit "GHC.Stack.Types")
502

Facundo Domínguez's avatar
Facundo Domínguez committed
503
504
505
506
507
508
gHC_STATICPTR :: Module
gHC_STATICPTR = mkBaseModule (fsLit "GHC.StaticPtr")

gHC_FINGERPRINT_TYPE :: Module
gHC_FINGERPRINT_TYPE = mkBaseModule (fsLit "GHC.Fingerprint.Type")

Adam Gundry's avatar
Adam Gundry committed
509
510
511
gHC_OVER_LABELS :: Module
gHC_OVER_LABELS = mkBaseModule (fsLit "GHC.OverloadedLabels")

Ian Lynagh's avatar
Ian Lynagh committed
512
mAIN, rOOT_MAIN :: Module
513
514
mAIN            = mkMainModule_ mAIN_NAME
rOOT_MAIN       = mkMainModule (fsLit ":Main") -- Root module for initialisation
Simon Marlow's avatar
Simon Marlow committed
515

516
517
mkInteractiveModule :: Int -> Module
-- (mkInteractiveMoudule 9) makes module 'interactive:M9'
518
mkInteractiveModule n = mkModule interactiveUnitId (mkModuleName ("Ghci" ++ show n))
Simon Marlow's avatar
Simon Marlow committed
519

Ian Lynagh's avatar
Ian Lynagh committed
520
pRELUDE_NAME, mAIN_NAME :: ModuleName
Ian Lynagh's avatar
Ian Lynagh committed
521
522
pRELUDE_NAME   = mkModuleNameFS (fsLit "Prelude")
mAIN_NAME      = mkModuleNameFS (fsLit "Main")
Simon Marlow's avatar
Simon Marlow committed
523

524
525
526
527
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
528
mkPrimModule :: FastString -> Module
529
mkPrimModule m = mkModule primUnitId (mkModuleNameFS m)
Ian Lynagh's avatar
Ian Lynagh committed
530
531

mkIntegerModule :: FastString -> Module
532
mkIntegerModule m = mkModule integerUnitId (mkModuleNameFS m)
Ian Lynagh's avatar
Ian Lynagh committed
533

Simon Marlow's avatar
Simon Marlow committed
534
mkBaseModule :: FastString -> Module
535
mkBaseModule m = mkModule baseUnitId (mkModuleNameFS m)
Simon Marlow's avatar
Simon Marlow committed
536
537

mkBaseModule_ :: ModuleName -> Module
538
mkBaseModule_ m = mkModule baseUnitId m
Simon Marlow's avatar
Simon Marlow committed
539

540
mkThisGhcModule :: FastString -> Module
541
mkThisGhcModule m = mkModule thisGhcUnitId (mkModuleNameFS m)
542
543

mkThisGhcModule_ :: ModuleName -> Module
544
mkThisGhcModule_ m = mkModule thisGhcUnitId m
545

Simon Marlow's avatar
Simon Marlow committed
546
mkMainModule :: FastString -> Module
547
mkMainModule m = mkModule mainUnitId (mkModuleNameFS m)
548

Simon Marlow's avatar
Simon Marlow committed
549
mkMainModule_ :: ModuleName -> Module
550
mkMainModule_ m = mkModule mainUnitId m
551

Austin Seipp's avatar
Austin Seipp committed
552
553
554
{-
************************************************************************
*                                                                      *
555
                        RdrNames
Austin Seipp's avatar
Austin Seipp committed
556
557
558
*                                                                      *
************************************************************************
-}
559

Ian Lynagh's avatar
Ian Lynagh committed
560
main_RDR_Unqual    :: RdrName
561
562
563
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
564

565
forall_tv_RDR, dot_tv_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
566
567
forall_tv_RDR = mkUnqual tvName (fsLit "forall")
dot_tv_RDR    = mkUnqual tvName (fsLit ".")
568

Ian Lynagh's avatar
Ian Lynagh committed
569
570
eq_RDR, ge_RDR, ne_RDR, le_RDR, lt_RDR, gt_RDR, compare_RDR,
    ltTag_RDR, eqTag_RDR, gtTag_RDR :: RdrName
571
572
573
574
575
576
577
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
578
579
580
ltTag_RDR               = dataQual_RDR gHC_TYPES (fsLit "LT")
eqTag_RDR               = dataQual_RDR gHC_TYPES (fsLit "EQ")
gtTag_RDR               = dataQual_RDR gHC_TYPES (fsLit "GT")
581

Ian Lynagh's avatar
Ian Lynagh committed
582
583
eqClass_RDR, numClass_RDR, ordClass_RDR, enumClass_RDR, monadClass_RDR
    :: RdrName
584
585
586
587
588
eqClass_RDR             = nameRdrName eqClassName
numClass_RDR            = nameRdrName numClassName
ordClass_RDR            = nameRdrName ordClassName
enumClass_RDR           = nameRdrName enumClassName
monadClass_RDR          = nameRdrName monadClassName
589

Ian Lynagh's avatar
Ian Lynagh committed
590
map_RDR, append_RDR :: RdrName
591
592
map_RDR                 = varQual_RDR gHC_BASE (fsLit "map")
append_RDR              = varQual_RDR gHC_BASE (fsLit "++")
593

quchen's avatar
quchen committed
594
foldr_RDR, build_RDR, returnM_RDR, bindM_RDR, failM_RDR_preMFP, failM_RDR:: RdrName
595
596
597
598
foldr_RDR               = nameRdrName foldrName
build_RDR               = nameRdrName buildName
returnM_RDR             = nameRdrName returnMName
bindM_RDR               = nameRdrName bindMName
quchen's avatar
quchen committed
599
failM_RDR_preMFP        = nameRdrName failMName_preMFP
600
failM_RDR               = nameRdrName failMName
601

Ian Lynagh's avatar
Ian Lynagh committed
602
left_RDR, right_RDR :: RdrName
603
604
left_RDR                = nameRdrName leftDataConName
right_RDR               = nameRdrName rightDataConName
605

Ian Lynagh's avatar
Ian Lynagh committed
606
fromEnum_RDR, toEnum_RDR :: RdrName
607
608
fromEnum_RDR            = varQual_RDR gHC_ENUM (fsLit "fromEnum")
toEnum_RDR              = varQual_RDR gHC_ENUM (fsLit "toEnum")
609

Ian Lynagh's avatar
Ian Lynagh committed
610
enumFrom_RDR, enumFromTo_RDR, enumFromThen_RDR, enumFromThenTo_RDR :: RdrName
611
612
613
614
enumFrom_RDR            = nameRdrName enumFromName
enumFromTo_RDR          = nameRdrName enumFromToName
enumFromThen_RDR        = nameRdrName enumFromThenName
enumFromThenTo_RDR      = nameRdrName enumFromThenToName
615

Ian Lynagh's avatar
Ian Lynagh committed
616
ratioDataCon_RDR, plusInteger_RDR, timesInteger_RDR :: RdrName
617
618
619
ratioDataCon_RDR        = nameRdrName ratioDataConName
plusInteger_RDR         = nameRdrName plusIntegerName
timesInteger_RDR        = nameRdrName timesIntegerName
620

Ian Lynagh's avatar
Ian Lynagh committed
621
ioDataCon_RDR :: RdrName
622
ioDataCon_RDR           = nameRdrName ioDataConName
623

Ian Lynagh's avatar
Ian Lynagh committed
624
625
eqString_RDR, unpackCString_RDR, unpackCStringFoldr_RDR,
    unpackCStringUtf8_RDR :: RdrName
626
627
628
629
eqString_RDR            = nameRdrName eqStringName
unpackCString_RDR       = nameRdrName unpackCStringName
unpackCStringFoldr_RDR  = nameRdrName unpackCStringFoldrName
unpackCStringUtf8_RDR   = nameRdrName unpackCStringUtf8Name
630

631
newStablePtr_RDR :: RdrName
632
newStablePtr_RDR        = nameRdrName newStablePtrName
633

Ian Lynagh's avatar
Ian Lynagh committed
634
bindIO_RDR, returnIO_RDR :: RdrName
635
636
bindIO_RDR              = nameRdrName bindIOName
returnIO_RDR            = nameRdrName returnIOName
637

Ian Lynagh's avatar
Ian Lynagh committed
638
fromInteger_RDR, fromRational_RDR, minus_RDR, times_RDR, plus_RDR :: RdrName
639
640
641
642
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
643
plus_RDR                = varQual_RDR gHC_NUM (fsLit "+")
Simon Marlow's avatar
Simon Marlow committed
644

Ryan Scott's avatar
Ryan Scott committed
645
646
647
648
649
toInteger_RDR, toRational_RDR, fromIntegral_RDR :: RdrName
toInteger_RDR           = nameRdrName toIntegerName
toRational_RDR          = nameRdrName toRationalName
fromIntegral_RDR        = nameRdrName fromIntegralName

650
651
stringTy_RDR, fromString_RDR :: RdrName
stringTy_RDR            = tcQual_RDR gHC_BASE (fsLit "String")
652
fromString_RDR          = nameRdrName fromStringName
653

654
655
656
657
658
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
659
compose_RDR :: RdrName
660
compose_RDR             = varQual_RDR gHC_BASE (fsLit ".")
Simon Marlow's avatar
Simon Marlow committed
661

Ian Lynagh's avatar
Ian Lynagh committed
662
not_RDR, getTag_RDR, succ_RDR, pred_RDR, minBound_RDR, maxBound_RDR,
663
    and_RDR, range_RDR, inRange_RDR, index_RDR,
Ian Lynagh's avatar
Ian Lynagh committed
664
    unsafeIndex_RDR, unsafeRangeSize_RDR :: RdrName
665
666
667
668
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
669
670
671
672
673
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")
674
675
676
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
677

Ian Lynagh's avatar
Ian Lynagh committed
678
readList_RDR, readListDefault_RDR, readListPrec_RDR, readListPrecDefault_RDR,
679
    readPrec_RDR, parens_RDR, choose_RDR, lexP_RDR, expectP_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
680
681
682
683
684
685
686
687
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")
688
expectP_RDR             = varQual_RDR gHC_READ (fsLit "expectP")
689

Ian Lynagh's avatar
Ian Lynagh committed
690
punc_RDR, ident_RDR, symbol_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
691
692
693
punc_RDR                = dataQual_RDR lEX (fsLit "Punc")
ident_RDR               = dataQual_RDR lEX (fsLit "Ident")
symbol_RDR              = dataQual_RDR lEX (fsLit "Symbol")
694

695
step_RDR, alt_RDR, reset_RDR, prec_RDR, pfail_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
696
step_RDR                = varQual_RDR  rEAD_PREC (fsLit "step")
697
alt_RDR                 = varQual_RDR  rEAD_PREC (fsLit "+++")
Ian Lynagh's avatar
Ian Lynagh committed
698
699
reset_RDR               = varQual_RDR  rEAD_PREC (fsLit "reset")
prec_RDR                = varQual_RDR  rEAD_PREC (fsLit "prec")
700
pfail_RDR               = varQual_RDR  rEAD_PREC (fsLit "pfail")
701

Thomas Miedema's avatar
Thomas Miedema committed
702
showList_RDR, showList___RDR, showsPrec_RDR, shows_RDR, showString_RDR,
Ian Lynagh's avatar
Ian Lynagh committed
703
    showSpace_RDR, showParen_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
704
705
showList_RDR            = varQual_RDR gHC_SHOW (fsLit "showList")
showList___RDR          = varQual_RDR gHC_SHOW (fsLit "showList__")
706
showsPrec_RDR           = varQual_RDR gHC_SHOW (fsLit "showsPrec")
Thomas Miedema's avatar
Thomas Miedema committed
707
shows_RDR               = varQual_RDR gHC_SHOW (fsLit "shows")
Ian Lynagh's avatar
Ian Lynagh committed
708
showString_RDR          = varQual_RDR gHC_SHOW (fsLit "showString")
709
710
showSpace_RDR           = varQual_RDR gHC_SHOW (fsLit "showSpace")
showParen_RDR           = varQual_RDR gHC_SHOW (fsLit "showParen")
711

Ian Lynagh's avatar
Ian Lynagh committed
712
undefined_RDR :: RdrName
Ian Lynagh's avatar
Ian Lynagh committed
713
undefined_RDR = varQual_RDR gHC_ERR (fsLit "undefined")
714

715
716
717
718
719
720
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
721
722
723
  prodDataCon_RDR, comp1DataCon_RDR,
  unPar1_RDR, unRec1_RDR, unK1_RDR, unComp1_RDR,
  from_RDR, from1_RDR, to_RDR, to1_RDR,
724
  datatypeName_RDR, moduleName_RDR, packageName_RDR, isNewtypeName_RDR,
725
  conName_RDR, conFixity_RDR, conIsRecord_RDR, selName_RDR,
726
  prefixDataCon_RDR, infixDataCon_RDR, leftAssocDataCon_RDR,
727
728
729
730
731
  rightAssocDataCon_RDR, notAssocDataCon_RDR,
  uAddrDataCon_RDR, uCharDataCon_RDR, uDoubleDataCon_RDR,
  uFloatDataCon_RDR, uIntDataCon_RDR, uWordDataCon_RDR,
  uAddrHash_RDR, uCharHash_RDR, uDoubleHash_RDR,
  uFloatHash_RDR, uIntHash_RDR, uWordHash_RDR :: RdrName
732
733
734
735
736
737
738
739
740
741
742
743
744

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
745
746
747
748
749
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")

750
from_RDR  = varQual_RDR gHC_GENERICS (fsLit "from")
751
from1_RDR = varQual_RDR gHC_GENERICS (fsLit "from1")
752
to_RDR    = varQual_RDR gHC_GENERICS (fsLit "to")
753
754
755
756
to1_RDR   = varQual_RDR gHC_GENERICS (fsLit "to1")

datatypeName_RDR  = varQual_RDR gHC_GENERICS (fsLit "datatypeName")
moduleName_RDR    = varQual_RDR gHC_GENERICS (fsLit "moduleName")
757
packageName_RDR   = varQual_RDR gHC_GENERICS (fsLit "packageName")
758
isNewtypeName_RDR = varQual_RDR gHC_GENERICS (fsLit "isNewtype")
759
760
761
762
763
764
765
766
767
768
769
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")

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")

770
771
772
773
774
775
776
777
778
779
780
781
782
uAddrDataCon_RDR   = dataQual_RDR gHC_GENERICS (fsLit "UAddr")
uCharDataCon_RDR   = dataQual_RDR gHC_GENERICS (fsLit "UChar")
uDoubleDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "UDouble")
uFloatDataCon_RDR  = dataQual_RDR gHC_GENERICS (fsLit "UFloat")
uIntDataCon_RDR    = dataQual_RDR gHC_GENERICS (fsLit "UInt")
uWordDataCon_RDR   = dataQual_RDR gHC_GENERICS (fsLit "UWord")

uAddrHash_RDR   = varQual_RDR gHC_GENERICS (fsLit "uAddr#")
uCharHash_RDR   = varQual_RDR gHC_GENERICS (fsLit "uChar#")
uDoubleHash_RDR = varQual_RDR gHC_GENERICS (fsLit "uDouble#")
uFloatHash_RDR  = varQual_RDR gHC_GENERICS (fsLit "uFloat#")
uIntHash_RDR    = varQual_RDR gHC_GENERICS (fsLit "uInt#")
uWordHash_RDR   = varQual_RDR gHC_GENERICS (fsLit "uWord#")
783

784
785
fmap_RDR, pure_RDR, ap_RDR, foldable_foldr_RDR, foldMap_RDR,
    traverse_RDR, mempty_RDR, mappend_RDR :: RdrName
786
fmap_RDR                = varQual_RDR gHC_BASE (fsLit "fmap")
787
788
pure_RDR                = nameRdrName pureAName
ap_RDR                  = nameRdrName apAName
789
foldable_foldr_RDR      = varQual_RDR dATA_FOLDABLE       (fsLit "foldr")
790
foldMap_RDR             = varQual_RDR dATA_FOLDABLE       (fsLit "foldMap")
791
traverse_RDR            = varQual_RDR dATA_TRAVERSABLE    (fsLit "traverse")
792
793
mempty_RDR              = varQual_RDR gHC_BASE            (fsLit "mempty")
mappend_RDR             = varQual_RDR gHC_BASE            (fsLit "mappend")
794

795
796
797
eqTyCon_RDR :: RdrName
eqTyCon_RDR = tcQual_RDR dATA_TYPE_EQUALITY (fsLit "~")

798
----------------------
Ian Lynagh's avatar
Ian Lynagh committed
799
800
varQual_RDR, tcQual_RDR, clsQual_RDR, dataQual_RDR
    :: Module -> FastString -> RdrName
801
802
803
804
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)
805

Austin Seipp's avatar
Austin Seipp committed
806
807
808
{-
************************************************************************
*                                                                      *
809
\subsection{Known-key names}
Austin Seipp's avatar
Austin Seipp committed
810
811
*                                                                      *
************************************************************************
812

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

817
--MetaHaskell Extension  add the constrs and the lower case case
818
-- guys as well (perhaps) e.g. see  trueDataConName     below
Austin Seipp's avatar
Austin Seipp committed
819
-}
820

821
822
823
824
825
826
827
828
829
830
-- | Build a 'Name' for the 'Typeable' representation of the given special 'TyCon'.
-- Special 'TyCon's include @(->)@, @BOX@, @Constraint@, etc. See 'TysPrim'.
mkSpecialTyConRepName :: FastString -> Name -> Name
-- See Note [Grand plan for Typeable] in 'TcTypeable' in TcTypeable.
mkSpecialTyConRepName fs tc_name
  = mkExternalName (tyConRepNameUnique (nameUnique tc_name))
                   tYPEABLE_INTERNAL
                   (mkVarOccFS fs)
                   wiredInSrcSpan

831
832
833
wildCardName :: Name
wildCardName = mkSystemVarName wildCardKey (fsLit "wild")

Ian Lynagh's avatar
Ian Lynagh committed
834
runMainIOName :: Name
Ian Lynagh's avatar
Ian Lynagh committed
835
runMainIOName = varQual gHC_TOP_HANDLER (fsLit "runMainIO") runMainKey
836

837
orderingTyConName, ltDataConName, eqDataConName, gtDataConName :: Name
838
839
840
841
orderingTyConName = tcQual  gHC_TYPES (fsLit "Ordering") orderingTyConKey
ltDataConName     = dcQual gHC_TYPES (fsLit "LT") ltDataConKey
eqDataConName     = dcQual gHC_TYPES (fsLit "EQ") eqDataConKey
gtDataConName     = dcQual gHC_TYPES (fsLit "GT") gtDataConKey
842
843
844

specTyConName :: Name
specTyConName     = tcQual gHC_TYPES (fsLit "SPEC") specTyConKey
Ian Lynagh's avatar
Ian Lynagh committed
845

Ian Lynagh's avatar
Ian Lynagh committed
846
eitherTyConName, leftDataConName, rightDataConName :: Name
847
eitherTyConName   = tcQual  dATA_EITHER (fsLit "Either") eitherTyConKey
848
849
leftDataConName   = dcQual dATA_EITHER (fsLit "Left")   leftDataConKey
rightDataConName  = dcQual dATA_EITHER (fsLit "Right")  rightDataConKey
850

851
852
853
-- Generics (types)
v1TyConName, u1TyConName, par1TyConName, rec1TyConName,
  k1TyConName, m1TyConName, sumTyConName, prodTyConName,
854
855
  compTyConName, rTyConName, dTyConName,
  cTyConName, sTyConName, rec0TyConName,
856
  d1TyConName, c1TyConName, s1TyConName, noSelTyConName,
857
858
  repTyConName, rep1TyConName, uRecTyConName,
  uAddrTyConName, uCharTyConName, uDoubleTyConName,
859
860
861
  uFloatTyConName, uIntTyConName, uWordTyConName,
  prefixIDataConName, infixIDataConName, leftAssociativeDataConName,
  rightAssociativeDataConName, notAssociativeDataConName,
862
863
864
865
866
  sourceUnpackDataConName, sourceNoUnpackDataConName,
  noSourceUnpackednessDataConName, sourceLazyDataConName,
  sourceStrictDataConName, noSourceStrictnessDataConName,
  decidedLazyDataConName, decidedStrictDataConName, decidedUnpackDataConName,
  metaDataDataConName, metaConsDataConName, metaSelDataConName :: Name
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889

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
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
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

890
repTyConName  = tcQual gHC_GENERICS (fsLit "Rep")  repTyConKey
891
892
rep1TyConName = tcQual gHC_GENERICS (fsLit "Rep1") rep1TyConKey

893
894
895
896
897
898
899
900
uRecTyConName      = tcQual gHC_GENERICS (fsLit "URec") uRecTyConKey
uAddrTyConName     = tcQual gHC_GENERICS (fsLit "UAddr") uAddrTyConKey
uCharTyConName     = tcQual gHC_GENERICS (fsLit "UChar") uCharTyConKey
uDoubleTyConName   = tcQual gHC_GENERICS (fsLit "UDouble") uDoubleTyConKey
uFloatTyConName    = tcQual gHC_GENERICS (fsLit "UFloat") uFloatTyConKey
uIntTyConName      = tcQual gHC_GENERICS (fsLit "UInt") uIntTyConKey
uWordTyConName     = tcQual gHC_GENERICS (fsLit "UWord") uWordTyConKey

901
902
903
904
905
906
prefixIDataConName = dcQual gHC_GENERICS (fsLit "PrefixI")  prefixIDataConKey
infixIDataConName  = dcQual gHC_GENERICS (fsLit "InfixI")   infixIDataConKey
leftAssociativeDataConName  = dcQual gHC_GENERICS (fsLit "LeftAssociative")   leftAssociativeDataConKey
rightAssociativeDataConName = dcQual gHC_GENERICS (fsLit "RightAssociative")  rightAssociativeDataConKey
notAssociativeDataConName   = dcQual gHC_GENERICS (fsLit "NotAssociative")    notAssociativeDataConKey

907
908
909
910
911
912
913
914
915
916
sourceUnpackDataConName         = dcQual gHC_GENERICS (fsLit "SourceUnpack")         sourceUnpackDataConKey
sourceNoUnpackDataConName       = dcQual gHC_GENERICS (fsLit "SourceNoUnpack")       sourceNoUnpackDataConKey
noSourceUnpackednessDataConName = dcQual gHC_GENERICS (fsLit "NoSourceUnpackedness") noSourceUnpackednessDataConKey
sourceLazyDataConName           = dcQual gHC_GENERICS (fsLit "SourceLazy")           sourceLazyDataConKey
sourceStrictDataConName         = dcQual gHC_GENERICS (fsLit "SourceStrict")         sourceStrictDataConKey
noSourceStrictnessDataConName   = dcQual gHC_GENERICS (fsLit "NoSourceStrictness")   noSourceStrictnessDataConKey
decidedLazyDataConName          = dcQual gHC_GENERICS (fsLit "DecidedLazy")          decidedLazyDataConKey
decidedStrictDataConName        = dcQual gHC_GENERICS (fsLit "DecidedStrict")        decidedStrictDataConKey
decidedUnpackDataConName        = dcQual gHC_GENERICS (fsLit "DecidedUnpack")        decidedUnpackDataConKey

917
918
919
920
metaDataDataConName  = dcQual gHC_GENERICS (fsLit "MetaData")  metaDataDataConKey
metaConsDataConName  = dcQual gHC_GENERICS (fsLit "MetaCons")  metaConsDataConKey
metaSelDataConName   = dcQual gHC_GENERICS (fsLit "MetaSel")   metaSelDataConKey

921
-- Base strings Strings
Ian Lynagh's avatar
Ian Lynagh committed
922
unpackCStringName, unpackCStringFoldrName,
923
    unpackCStringUtf8Name, eqStringName :: Name
924
925
926
unpackCStringName       = varQual gHC_CSTRING (fsLit "unpackCString#") unpackCStringIdKey
unpackCStringFoldrName  = varQual gHC_CSTRING (fsLit "unpackFoldrCString#") unpackCStringFoldrIdKey
unpackCStringUtf8Name   = varQual gHC_CSTRING (