[project @ 2002-10-24 14:17:46 by simonpj]
[ghc-hetmet.git] / ghc / compiler / prelude / TysWiredIn.lhs
1 %
2 % (c) The GRASP Project, Glasgow University, 1994-1998
3 %
4 \section[TysWiredIn]{Wired-in knowledge about {\em non-primitive} types}
5
6 This module is about types that can be defined in Haskell, but which
7 must be wired into the compiler nonetheless.
8
9 This module tracks the ``state interface'' document, ``GHC prelude:
10 types and operations.''
11
12 \begin{code}
13 module TysWiredIn (
14         wiredInTyCons, genericTyCons,
15
16         addrDataCon,
17         addrTy,
18         addrTyCon,
19         ptrDataCon,
20         ptrTy,
21         ptrTyCon,
22         funPtrDataCon,
23         funPtrTy,
24         funPtrTyCon,
25         boolTy,
26         boolTyCon,
27         charDataCon,
28         charTy,
29         charTyCon,
30         consDataCon,
31         doubleDataCon,
32         doubleTy,
33         doubleTyCon,
34         falseDataCon, falseDataConId,
35         floatDataCon,
36         floatTy,
37         floatTyCon,
38
39         intDataCon,
40         intTy,
41         intTyCon,
42
43         integerTy,
44         integerTyCon,
45         smallIntegerDataCon,
46         largeIntegerDataCon,
47
48         listTyCon,
49
50         mkListTy,
51         nilDataCon,
52
53         -- tuples
54         mkTupleTy,
55         tupleTyCon, tupleCon, 
56         unitTyCon, unitDataCon, unitDataConId, pairTyCon, 
57         unboxedSingletonTyCon, unboxedSingletonDataCon,
58         unboxedPairTyCon, unboxedPairDataCon,
59
60         -- Generics
61         genUnitTyCon, genUnitDataCon, 
62         plusTyCon, inrDataCon, inlDataCon,
63         crossTyCon, crossDataCon,
64
65         stablePtrTyCon,
66         stringTy,
67         trueDataCon, trueDataConId,
68         unitTy,
69         voidTy,
70         wordDataCon,
71         wordTy,
72         wordTyCon,
73
74         -- parallel arrays
75         mkPArrTy,
76         parrTyCon, parrFakeCon, isPArrTyCon, isPArrFakeCon
77     ) where
78
79 #include "HsVersions.h"
80
81 import {-# SOURCE #-} MkId( mkDataConId, mkDataConWrapId )
82 import {-# SOURCE #-} Generics( mkTyConGenInfo )
83
84 -- friends:
85 import PrelNames
86 import TysPrim
87
88 -- others:
89 import Constants        ( mAX_TUPLE_SIZE )
90 import Module           ( mkBasePkgModule )
91 import Name             ( Name, nameUnique, nameOccName, 
92                           nameModule, mkWiredInName )
93 import OccName          ( mkOccFS, tcName, dataName, mkWorkerOcc, mkGenOcc1, mkGenOcc2 )
94 import DataCon          ( DataCon, mkDataCon, dataConWorkId, dataConSourceArity )
95 import Var              ( TyVar, tyVarKind )
96 import TyCon            ( TyCon, AlgTyConFlavour(..), DataConDetails(..), tyConDataCons,
97                           mkTupleTyCon, mkAlgTyCon, tyConName
98                         )
99
100 import BasicTypes       ( Arity, RecFlag(..), Boxity(..), isBoxed, StrictnessMark(..) )
101
102 import Type             ( Type, mkTyConTy, mkTyConApp, mkTyVarTy, mkTyVarTys, 
103                           mkArrowKinds, liftedTypeKind, unliftedTypeKind,
104                           ThetaType )
105 import Unique           ( incrUnique, mkTupleTyConUnique,
106                           mkTupleDataConUnique, mkPArrDataConUnique )
107 import PrelNames
108 import Array
109 import FastString
110
111 alpha_tyvar       = [alphaTyVar]
112 alpha_ty          = [alphaTy]
113 alpha_beta_tyvars = [alphaTyVar, betaTyVar]
114 \end{code}
115
116
117 %************************************************************************
118 %*                                                                      *
119 \subsection{Wired in type constructors}
120 %*                                                                      *
121 %************************************************************************
122
123 If you change which things are wired in, make sure you change their
124 names in PrelNames, so they use wTcQual, wDataQual, etc
125
126 \begin{code}
127 wiredInTyCons :: [TyCon]
128 wiredInTyCons = data_tycons ++ tuple_tycons ++ unboxed_tuple_tycons
129
130 data_tycons = genericTyCons ++
131               [ addrTyCon
132               , ptrTyCon
133               , funPtrTyCon
134               , boolTyCon
135               , charTyCon
136               , doubleTyCon
137               , floatTyCon
138               , intTyCon
139               , integerTyCon
140               , listTyCon
141               , parrTyCon
142               , wordTyCon
143               ]
144
145 genericTyCons :: [TyCon]
146 genericTyCons = [ plusTyCon, crossTyCon, genUnitTyCon ]
147
148 tuple_tycons = unitTyCon : [tupleTyCon Boxed   i | i <- [2..mAX_TUPLE_SIZE] ]
149 unboxed_tuple_tycons     = [tupleTyCon Unboxed i | i <- [1..mAX_TUPLE_SIZE] ]
150 \end{code}
151
152
153 %************************************************************************
154 %*                                                                      *
155 \subsection{mkWiredInTyCon}
156 %*                                                                      *
157 %************************************************************************
158
159 \begin{code}
160 pcNonRecDataTyCon = pcTyCon DataTyCon NonRecursive
161 pcRecDataTyCon = pcTyCon DataTyCon Recursive
162
163 pcTyCon new_or_data is_rec name tyvars argvrcs cons
164   = tycon
165   where
166     tycon = mkAlgTyCon name kind
167                 tyvars
168                 []              -- No context
169                 argvrcs
170                 (DataCons cons)
171                 []              -- No record selectors
172                 new_or_data
173                 is_rec
174                 gen_info
175
176     mod      = nameModule name
177     kind     = mkArrowKinds (map tyVarKind tyvars) liftedTypeKind
178     gen_info = mk_tc_gen_info mod (nameUnique name) name tycon
179
180 -- We generate names for the generic to/from Ids by incrementing
181 -- the TyCon unique.  So each Prelude tycon needs 3 slots, one
182 -- for itself and two more for the generic Ids.
183 mk_tc_gen_info mod tc_uniq tc_name tycon
184   = mkTyConGenInfo tycon [name1, name2]
185   where
186         tc_occ_name = nameOccName tc_name
187         occ_name1   = mkGenOcc1 tc_occ_name
188         occ_name2   = mkGenOcc2 tc_occ_name
189         fn1_key     = incrUnique tc_uniq
190         fn2_key     = incrUnique fn1_key
191         name1       = mkWiredInName  mod occ_name1 fn1_key
192         name2       = mkWiredInName  mod occ_name2 fn2_key
193
194 pcDataCon :: Name -> [TyVar] -> ThetaType -> [Type] -> TyCon -> DataCon
195 -- The unique is the first of two free uniques;
196 -- the first is used for the datacon itself and the worker;
197 -- the second is used for the wrapper.
198
199 pcDataCon name tyvars context arg_tys tycon
200   = data_con
201   where
202     data_con = mkDataCon name
203                 [ NotMarkedStrict | a <- arg_tys ]
204                 [ {- no labelled fields -} ]
205                 tyvars context [] [] arg_tys tycon work_id wrap_id
206
207     wrap_occ  = nameOccName name
208
209     mod       = nameModule name
210     wrap_id   = mkDataConWrapId data_con
211
212     work_occ  = mkWorkerOcc wrap_occ
213     work_key  = incrUnique (nameUnique name)
214     work_name = mkWiredInName mod work_occ work_key
215     work_id   = mkDataConId work_name data_con
216 \end{code}
217
218
219 %************************************************************************
220 %*                                                                      *
221 \subsection[TysWiredIn-tuples]{The tuple types}
222 %*                                                                      *
223 %************************************************************************
224
225 \begin{code}
226 tupleTyCon :: Boxity -> Arity -> TyCon
227 tupleTyCon boxity i | i > mAX_TUPLE_SIZE = fst (mk_tuple boxity i)      -- Build one specially
228 tupleTyCon Boxed   i = fst (boxedTupleArr   ! i)
229 tupleTyCon Unboxed i = fst (unboxedTupleArr ! i)
230
231 tupleCon :: Boxity -> Arity -> DataCon
232 tupleCon boxity i | i > mAX_TUPLE_SIZE = snd (mk_tuple boxity i)        -- Build one specially
233 tupleCon Boxed   i = snd (boxedTupleArr   ! i)
234 tupleCon Unboxed i = snd (unboxedTupleArr ! i)
235
236 boxedTupleArr, unboxedTupleArr :: Array Int (TyCon,DataCon)
237 boxedTupleArr   = array (0,mAX_TUPLE_SIZE) [(i,mk_tuple Boxed i)   | i <- [0..mAX_TUPLE_SIZE]]
238 unboxedTupleArr = array (0,mAX_TUPLE_SIZE) [(i,mk_tuple Unboxed i) | i <- [0..mAX_TUPLE_SIZE]]
239
240 mk_tuple :: Boxity -> Int -> (TyCon,DataCon)
241 mk_tuple boxity arity = (tycon, tuple_con)
242   where
243         tycon   = mkTupleTyCon tc_name tc_kind arity tyvars tuple_con boxity gen_info 
244         tc_name = mkWiredInName mod (mkOccFS tcName name_str) tc_uniq
245         tc_kind = mkArrowKinds (map tyVarKind tyvars) res_kind
246         res_kind | isBoxed boxity = liftedTypeKind
247                  | otherwise      = unliftedTypeKind
248
249         tyvars   | isBoxed boxity = take arity alphaTyVars
250                  | otherwise      = take arity openAlphaTyVars
251
252         tuple_con = pcDataCon name tyvars [] tyvar_tys tycon
253         tyvar_tys = mkTyVarTys tyvars
254         (mod_name, name_str) = mkTupNameStr boxity arity
255         name      = mkWiredInName mod (mkOccFS dataName name_str) dc_uniq
256         tc_uniq   = mkTupleTyConUnique   boxity arity
257         dc_uniq   = mkTupleDataConUnique boxity arity
258         mod       = mkBasePkgModule mod_name
259         gen_info  = mk_tc_gen_info mod tc_uniq tc_name tycon
260
261 unitTyCon     = tupleTyCon Boxed 0
262 unitDataCon   = head (tyConDataCons unitTyCon)
263 unitDataConId = dataConWorkId unitDataCon
264
265 pairTyCon = tupleTyCon Boxed 2
266
267 unboxedSingletonTyCon   = tupleTyCon Unboxed 1
268 unboxedSingletonDataCon = tupleCon   Unboxed 1
269
270 unboxedPairTyCon   = tupleTyCon Unboxed 2
271 unboxedPairDataCon = tupleCon   Unboxed 2
272 \end{code}
273
274 %************************************************************************
275 %*                                                                      *
276 \subsection[TysWiredIn-boxed-prim]{The ``boxed primitive'' types (@Char@, @Int@, etc)}
277 %*                                                                      *
278 %************************************************************************
279
280 \begin{code}
281 -- The Void type is represented as a data type with no constructors
282 -- It's a built in type (i.e. there's no way to define it in Haskell;
283 --      the nearest would be
284 --
285 --              data Void =             -- No constructors!
286 --
287 -- ) It's lifted; there is only one value of this
288 -- type, namely "void", whose semantics is just bottom.
289 --
290 -- Haskell 98 drops the definition of a Void type, so we just 'simulate'
291 -- voidTy using ().
292 voidTy = unitTy
293 \end{code}
294
295
296 \begin{code}
297 charTy = mkTyConTy charTyCon
298
299 charTyCon   = pcNonRecDataTyCon charTyConName [] [] [charDataCon]
300 charDataCon = pcDataCon charDataConName [] [] [charPrimTy] charTyCon
301
302 stringTy = mkListTy charTy -- convenience only
303 \end{code}
304
305 \begin{code}
306 intTy = mkTyConTy intTyCon 
307
308 intTyCon = pcNonRecDataTyCon intTyConName [] [] [intDataCon]
309 intDataCon = pcDataCon intDataConName [] [] [intPrimTy] intTyCon
310 \end{code}
311
312 \begin{code}
313 wordTy = mkTyConTy wordTyCon
314
315 wordTyCon = pcNonRecDataTyCon wordTyConName [] [] [wordDataCon]
316 wordDataCon = pcDataCon wordDataConName [] [] [wordPrimTy] wordTyCon
317 \end{code}
318
319 \begin{code}
320 addrTy = mkTyConTy addrTyCon
321
322 addrTyCon = pcNonRecDataTyCon addrTyConName [] [] [addrDataCon]
323 addrDataCon = pcDataCon addrDataConName [] [] [addrPrimTy] addrTyCon
324 \end{code}
325
326 \begin{code}
327 ptrTy = mkTyConTy ptrTyCon
328
329 ptrTyCon = pcNonRecDataTyCon ptrTyConName alpha_tyvar [(True,False)] [ptrDataCon]
330 ptrDataCon = pcDataCon ptrDataConName alpha_tyvar [] [addrPrimTy] ptrTyCon
331 \end{code}
332
333 \begin{code}
334 funPtrTy = mkTyConTy funPtrTyCon
335
336 funPtrTyCon = pcNonRecDataTyCon funPtrTyConName alpha_tyvar [(True,False)] [funPtrDataCon]
337 funPtrDataCon = pcDataCon funPtrDataConName alpha_tyvar [] [addrPrimTy] funPtrTyCon
338 \end{code}
339
340 \begin{code}
341 floatTy = mkTyConTy floatTyCon
342
343 floatTyCon   = pcNonRecDataTyCon floatTyConName   [] [] [floatDataCon]
344 floatDataCon = pcDataCon         floatDataConName [] [] [floatPrimTy] floatTyCon
345 \end{code}
346
347 \begin{code}
348 doubleTy = mkTyConTy doubleTyCon
349
350 doubleTyCon   = pcNonRecDataTyCon doubleTyConName     [] [] [doubleDataCon]
351 doubleDataCon = pcDataCon         doubleDataConName [] [] [doublePrimTy] doubleTyCon
352 \end{code}
353
354 \begin{code}
355 stablePtrTyCon
356   = pcNonRecDataTyCon stablePtrTyConName
357         alpha_tyvar [(True,False)] [stablePtrDataCon]
358   where
359     stablePtrDataCon
360       = pcDataCon stablePtrDataConName
361             alpha_tyvar [] [mkStablePtrPrimTy alphaTy] stablePtrTyCon
362 \end{code}
363
364 %************************************************************************
365 %*                                                                      *
366 \subsection[TysWiredIn-Integer]{@Integer@ and its related ``pairing'' types}
367 %*                                                                      *
368 %************************************************************************
369
370 @Integer@ and its pals are not really primitive.  @Integer@ itself, first:
371 \begin{code}
372 integerTy :: Type
373 integerTy = mkTyConTy integerTyCon
374
375 integerTyCon = pcNonRecDataTyCon integerTyConName
376                    [] [] [smallIntegerDataCon, largeIntegerDataCon]
377
378 smallIntegerDataCon = pcDataCon smallIntegerDataConName
379                 [] [] [intPrimTy] integerTyCon
380 largeIntegerDataCon = pcDataCon largeIntegerDataConName
381                 [] [] [intPrimTy, byteArrayPrimTy] integerTyCon
382 \end{code}
383
384
385 %************************************************************************
386 %*                                                                      *
387 \subsection[TysWiredIn-Bool]{The @Bool@ type}
388 %*                                                                      *
389 %************************************************************************
390
391 An ordinary enumeration type, but deeply wired in.  There are no
392 magical operations on @Bool@ (just the regular Prelude code).
393
394 {\em BEGIN IDLE SPECULATION BY SIMON}
395
396 This is not the only way to encode @Bool@.  A more obvious coding makes
397 @Bool@ just a boxed up version of @Bool#@, like this:
398 \begin{verbatim}
399 type Bool# = Int#
400 data Bool = MkBool Bool#
401 \end{verbatim}
402
403 Unfortunately, this doesn't correspond to what the Report says @Bool@
404 looks like!  Furthermore, we get slightly less efficient code (I
405 think) with this coding. @gtInt@ would look like this:
406
407 \begin{verbatim}
408 gtInt :: Int -> Int -> Bool
409 gtInt x y = case x of I# x# ->
410             case y of I# y# ->
411             case (gtIntPrim x# y#) of
412                 b# -> MkBool b#
413 \end{verbatim}
414
415 Notice that the result of the @gtIntPrim@ comparison has to be turned
416 into an integer (here called @b#@), and returned in a @MkBool@ box.
417
418 The @if@ expression would compile to this:
419 \begin{verbatim}
420 case (gtInt x y) of
421   MkBool b# -> case b# of { 1# -> e1; 0# -> e2 }
422 \end{verbatim}
423
424 I think this code is a little less efficient than the previous code,
425 but I'm not certain.  At all events, corresponding with the Report is
426 important.  The interesting thing is that the language is expressive
427 enough to describe more than one alternative; and that a type doesn't
428 necessarily need to be a straightforwardly boxed version of its
429 primitive counterpart.
430
431 {\em END IDLE SPECULATION BY SIMON}
432
433 \begin{code}
434 boolTy = mkTyConTy boolTyCon
435
436 boolTyCon = pcTyCon EnumTyCon NonRecursive boolTyConName
437                     [] [] [falseDataCon, trueDataCon]
438
439 falseDataCon = pcDataCon falseDataConName [] [] [] boolTyCon
440 trueDataCon  = pcDataCon trueDataConName  [] [] [] boolTyCon
441
442 falseDataConId = dataConWorkId falseDataCon
443 trueDataConId  = dataConWorkId trueDataCon
444 \end{code}
445
446 %************************************************************************
447 %*                                                                      *
448 \subsection[TysWiredIn-List]{The @List@ type (incl ``build'' magic)}
449 %*                                                                      *
450 %************************************************************************
451
452 Special syntax, deeply wired in, but otherwise an ordinary algebraic
453 data types:
454 \begin{verbatim}
455 data [] a = [] | a : (List a)
456 data () = ()
457 data (,) a b = (,,) a b
458 ...
459 \end{verbatim}
460
461 \begin{code}
462 mkListTy :: Type -> Type
463 mkListTy ty = mkTyConApp listTyCon [ty]
464
465 listTyCon = pcRecDataTyCon listTyConName
466                         alpha_tyvar [(True,False)] [nilDataCon, consDataCon]
467
468 nilDataCon  = pcDataCon nilDataConName alpha_tyvar [] [] listTyCon
469 consDataCon = pcDataCon consDataConName
470                alpha_tyvar [] [alphaTy, mkTyConApp listTyCon alpha_ty] listTyCon
471 -- Interesting: polymorphic recursion would help here.
472 -- We can't use (mkListTy alphaTy) in the defn of consDataCon, else mkListTy
473 -- gets the over-specific type (Type -> Type)
474 \end{code}
475
476 %************************************************************************
477 %*                                                                      *
478 \subsection[TysWiredIn-Tuples]{The @Tuple@ types}
479 %*                                                                      *
480 %************************************************************************
481
482 The tuple types are definitely magic, because they form an infinite
483 family.
484
485 \begin{itemize}
486 \item
487 They have a special family of type constructors, of type @TyCon@
488 These contain the tycon arity, but don't require a Unique.
489
490 \item
491 They have a special family of constructors, of type
492 @Id@. Again these contain their arity but don't need a Unique.
493
494 \item
495 There should be a magic way of generating the info tables and
496 entry code for all tuples.
497
498 But at the moment we just compile a Haskell source
499 file\srcloc{lib/prelude/...} containing declarations like:
500 \begin{verbatim}
501 data Tuple0             = Tup0
502 data Tuple2  a b        = Tup2  a b
503 data Tuple3  a b c      = Tup3  a b c
504 data Tuple4  a b c d    = Tup4  a b c d
505 ...
506 \end{verbatim}
507 The print-names associated with the magic @Id@s for tuple constructors
508 ``just happen'' to be the same as those generated by these
509 declarations.
510
511 \item
512 The instance environment should have a magic way to know
513 that each tuple type is an instances of classes @Eq@, @Ix@, @Ord@ and
514 so on. \ToDo{Not implemented yet.}
515
516 \item
517 There should also be a way to generate the appropriate code for each
518 of these instances, but (like the info tables and entry code) it is
519 done by enumeration\srcloc{lib/prelude/InTup?.hs}.
520 \end{itemize}
521
522 \begin{code}
523 mkTupleTy :: Boxity -> Int -> [Type] -> Type
524 mkTupleTy boxity arity tys = mkTyConApp (tupleTyCon boxity arity) tys
525
526 unitTy    = mkTupleTy Boxed 0 []
527 \end{code}
528
529 %************************************************************************
530 %*                                                                      *
531 \subsection[TysWiredIn-PArr]{The @[::]@ type}
532 %*                                                                      *
533 %************************************************************************
534
535 Special syntax for parallel arrays needs some wired in definitions.
536
537 \begin{code}
538 -- construct a type representing the application of the parallel array
539 -- constructor 
540 --
541 mkPArrTy    :: Type -> Type
542 mkPArrTy ty  = mkTyConApp parrTyCon [ty]
543
544 -- represents the type constructor of parallel arrays
545 --
546 -- * this must match the definition in `PrelPArr'
547 --
548 -- NB: Although the constructor is given here, it will not be accessible in
549 --     user code as it is not in the environment of any compiled module except
550 --     `PrelPArr'.
551 --
552 parrTyCon :: TyCon
553 parrTyCon  = tycon
554   where
555     tycon   = mkAlgTyCon 
556                 parrTyConName 
557                 kind
558                 tyvars
559                 []                       -- No context
560                 [(True, False)]
561                 (DataCons [parrDataCon]) -- The constructor defined in `PrelPArr'
562                 []                       -- No record selectors
563                 DataTyCon
564                 NonRecursive
565                 genInfo
566     tyvars  = alpha_tyvar
567     mod     = nameModule parrTyConName
568     kind    = mkArrowKinds (map tyVarKind tyvars) liftedTypeKind
569     genInfo = mk_tc_gen_info mod (nameUnique parrTyConName) parrTyConName tycon
570
571 parrDataCon :: DataCon
572 parrDataCon  = pcDataCon 
573                  parrDataConName 
574                  alpha_tyvar            -- forall'ed type variables
575                  []                     -- context
576                  [intPrimTy,            -- 1st argument: Int#
577                   mkTyConApp            -- 2nd argument: Array# a
578                     arrayPrimTyCon 
579                     alpha_ty] 
580                  parrTyCon
581
582 -- check whether a type constructor is the constructor for parallel arrays
583 --
584 isPArrTyCon    :: TyCon -> Bool
585 isPArrTyCon tc  = tyConName tc == parrTyConName
586
587 -- fake array constructors
588 --
589 -- * these constructors are never really used to represent array values;
590 --   however, they are very convenient during desugaring (and, in particular,
591 --   in the pattern matching compiler) to treat array pattern just like
592 --   yet another constructor pattern
593 --
594 parrFakeCon                        :: Arity -> DataCon
595 parrFakeCon i | i > mAX_TUPLE_SIZE  = mkPArrFakeCon  i  -- build one specially
596 parrFakeCon i                       = parrFakeConArr!i
597
598 -- pre-defined set of constructors
599 --
600 parrFakeConArr :: Array Int DataCon
601 parrFakeConArr  = array (0, mAX_TUPLE_SIZE) [(i, mkPArrFakeCon i)   
602                                             | i <- [0..mAX_TUPLE_SIZE]]
603
604 -- build a fake parallel array constructor for the given arity
605 --
606 mkPArrFakeCon       :: Int -> DataCon
607 mkPArrFakeCon arity  = pcDataCon name [tyvar] [] tyvarTys parrTyCon
608   where
609         tyvar     = head alphaTyVars
610         tyvarTys  = replicate arity $ mkTyVarTy tyvar
611         nameStr   = mkFastString ("MkPArr" ++ show arity)
612         name      = mkWiredInName mod (mkOccFS dataName nameStr) uniq
613         uniq      = mkPArrDataConUnique arity
614         mod       = mkBasePkgModule pREL_PARR_Name
615
616 -- checks whether a data constructor is a fake constructor for parallel arrays
617 --
618 isPArrFakeCon      :: DataCon -> Bool
619 isPArrFakeCon dcon  = dcon == parrFakeCon (dataConSourceArity dcon)
620 \end{code}
621
622 %************************************************************************
623 %*                                                                      *
624 \subsection{Wired In Type Constructors for Representation Types}
625 %*                                                                      *
626 %************************************************************************
627
628 The following code defines the wired in datatypes cross, plus, unit
629 and c_of needed for the generic methods.
630
631 Ok, so the basic story is that for each type constructor I need to
632 create 2 things - a TyCon and a DataCon and then we are basically
633 ok. There are going to be no arguments passed to these functions
634 because -well- there is nothing to pass to these functions.
635
636 \begin{code}
637 crossTyCon :: TyCon
638 crossTyCon = pcNonRecDataTyCon crossTyConName alpha_beta_tyvars [] [crossDataCon]
639
640 crossDataCon :: DataCon
641 crossDataCon = pcDataCon crossDataConName alpha_beta_tyvars [] [alphaTy, betaTy] crossTyCon
642
643 plusTyCon :: TyCon
644 plusTyCon = pcNonRecDataTyCon plusTyConName alpha_beta_tyvars [] [inlDataCon, inrDataCon]
645
646 inlDataCon, inrDataCon :: DataCon
647 inlDataCon = pcDataCon inlDataConName alpha_beta_tyvars [] [alphaTy] plusTyCon
648 inrDataCon = pcDataCon inrDataConName alpha_beta_tyvars [] [betaTy]  plusTyCon
649
650 genUnitTyCon :: TyCon   -- The "1" type constructor for generics
651 genUnitTyCon = pcNonRecDataTyCon genUnitTyConName [] [] [genUnitDataCon]
652
653 genUnitDataCon :: DataCon
654 genUnitDataCon = pcDataCon genUnitDataConName [] [] [] genUnitTyCon
655 \end{code}