2 % (c) The GRASP Project, Glasgow University, 1994-1995
4 \section[TysWiredIn]{Wired-in knowledge about {\em non-primitive} types}
6 This module is about types that can be defined in Haskell, but which
7 must be wired into the compiler nonetheless.
9 This module tracks the ``state interface'' document, ``GHC prelude:
10 types and operations.''
13 #include "HsVersions.h"
32 getStatePairingConInfo,
57 stateAndAddrPrimTyCon,
58 stateAndArrayPrimTyCon,
59 stateAndByteArrayPrimTyCon,
60 stateAndCharPrimTyCon,
61 stateAndDoublePrimTyCon,
62 stateAndFloatPrimTyCon,
64 stateAndForeignObjPrimTyCon,
65 stateAndMutableArrayPrimTyCon,
66 stateAndMutableByteArrayPrimTyCon,
68 stateAndStablePtrPrimTyCon,
69 stateAndSynchVarPrimTyCon,
70 stateAndWordPrimTyCon,
89 IMPORT_DELOOPER(TyLoop) ( mkDataCon, StrictnessMark(..) )
96 import SpecEnv ( SYN_IE(SpecEnv) )
97 import Kind ( mkBoxedTypeKind, mkArrowKind )
98 import Name ( mkWiredInName, ExportFlag(..) )
99 import SrcLoc ( mkBuiltinSrcLoc )
100 import TyCon ( mkDataTyCon, mkTupleTyCon, mkSynTyCon,
103 import Type ( mkTyConTy, applyTyCon, mkSigmaTy,
104 mkFunTy, maybeAppTyCon,
105 GenType(..), SYN_IE(ThetaType), SYN_IE(TauType) )
106 import TyVar ( tyVarKind, alphaTyVar, betaTyVar )
108 import Util ( assoc, panic )
110 nullSpecEnv = error "TysWiredIn:nullSpecEnv = "
111 addOneToSpecEnv = error "TysWiredIn:addOneToSpecEnv = "
112 pc_gen_specs = error "TysWiredIn:pc_gen_specs "
113 mkSpecInfo = error "TysWiredIn:SpecInfo"
115 alpha_tyvar = [alphaTyVar]
117 alpha_beta_tyvars = [alphaTyVar, betaTyVar]
119 pcDataTyCon, pcNewTyCon
120 :: Unique{-TyConKey-} -> Module -> FAST_STRING
121 -> [TyVar] -> [Id] -> TyCon
123 pcDataTyCon = pc_tycon DataType
124 pcNewTyCon = pc_tycon NewType
126 pc_tycon new_or_data key mod str tyvars cons
127 = mkDataTyCon (mkWiredInName key (OrigName mod str) ExportAll) tycon_kind
128 tyvars [{-no context-}] cons [{-no derivings-}]
131 tycon_kind = foldr (mkArrowKind . tyVarKind) mkBoxedTypeKind tyvars
133 pcSynTyCon key mod str kind arity tyvars expansion
135 (mkWiredInName key (OrigName mod str) ExportAll)
136 kind arity tyvars expansion
138 pcDataCon :: Unique{-DataConKey-} -> Module -> FAST_STRING
139 -> [TyVar] -> ThetaType -> [TauType] -> TyCon -> SpecEnv -> Id
140 pcDataCon key mod str tyvars context arg_tys tycon specenv
141 = mkDataCon (mkWiredInName key (OrigName mod str) ExportAll)
142 [ NotMarkedStrict | a <- arg_tys ]
143 [ {- no labelled fields -} ]
144 tyvars context arg_tys tycon
147 pcGenerateDataSpecs :: Type -> SpecEnv
148 pcGenerateDataSpecs ty
149 = pc_gen_specs False err err err ty
151 err = panic "PrelUtils:GenerateDataSpecs"
154 %************************************************************************
156 \subsection[TysWiredIn-boxed-prim]{The ``boxed primitive'' types (@Char@, @Int@, etc)}
158 %************************************************************************
161 charTy = mkTyConTy charTyCon
163 charTyCon = pcDataTyCon charTyConKey pRELUDE SLIT("Char") [] [charDataCon]
164 charDataCon = pcDataCon charDataConKey pRELUDE SLIT("C#") [] [] [charPrimTy] charTyCon nullSpecEnv
166 stringTy = mkListTy charTy -- convenience only
170 intTy = mkTyConTy intTyCon
172 intTyCon = pcDataTyCon intTyConKey pRELUDE SLIT("Int") [] [intDataCon]
173 intDataCon = pcDataCon intDataConKey pRELUDE SLIT("I#") [] [] [intPrimTy] intTyCon nullSpecEnv
177 wordTy = mkTyConTy wordTyCon
179 wordTyCon = pcDataTyCon wordTyConKey gHC__ SLIT("Word") [] [wordDataCon]
180 wordDataCon = pcDataCon wordDataConKey gHC__ SLIT("W#") [] [] [wordPrimTy] wordTyCon nullSpecEnv
184 addrTy = mkTyConTy addrTyCon
186 addrTyCon = pcDataTyCon addrTyConKey gHC__ SLIT("Addr") [] [addrDataCon]
187 addrDataCon = pcDataCon addrDataConKey gHC__ SLIT("A#") [] [] [addrPrimTy] addrTyCon nullSpecEnv
191 floatTy = mkTyConTy floatTyCon
193 floatTyCon = pcDataTyCon floatTyConKey pRELUDE SLIT("Float") [] [floatDataCon]
194 floatDataCon = pcDataCon floatDataConKey pRELUDE SLIT("F#") [] [] [floatPrimTy] floatTyCon nullSpecEnv
198 doubleTy = mkTyConTy doubleTyCon
200 doubleTyCon = pcDataTyCon doubleTyConKey pRELUDE SLIT("Double") [] [doubleDataCon]
201 doubleDataCon = pcDataCon doubleDataConKey pRELUDE SLIT("D#") [] [] [doublePrimTy] doubleTyCon nullSpecEnv
205 mkStateTy ty = applyTyCon stateTyCon [ty]
206 realWorldStateTy = mkStateTy realWorldTy -- a common use
208 stateTyCon = pcDataTyCon stateTyConKey gHC__ SLIT("State") alpha_tyvar [stateDataCon]
210 = pcDataCon stateDataConKey gHC__ SLIT("S#")
211 alpha_tyvar [] [mkStatePrimTy alphaTy] stateTyCon nullSpecEnv
216 = pcDataTyCon stablePtrTyConKey gHC__ SLIT("StablePtr")
217 alpha_tyvar [stablePtrDataCon]
220 = pcDataCon stablePtrDataConKey gHC__ SLIT("StablePtr")
221 alpha_tyvar [] [mkStablePtrPrimTy alphaTy] stablePtrTyCon nullSpecEnv
226 = pcDataTyCon foreignObjTyConKey gHC__ SLIT("ForeignObj")
227 [] [foreignObjDataCon]
230 = pcDataCon foreignObjDataConKey gHC__ SLIT("ForeignObj")
231 [] [] [foreignObjPrimTy] foreignObjTyCon nullSpecEnv
234 %************************************************************************
236 \subsection[TysWiredIn-Integer]{@Integer@ and its related ``pairing'' types}
238 %************************************************************************
240 @Integer@ and its pals are not really primitive. @Integer@ itself, first:
242 integerTy :: GenType t u
243 integerTy = mkTyConTy integerTyCon
245 integerTyCon = pcDataTyCon integerTyConKey pRELUDE SLIT("Integer") [] [integerDataCon]
247 integerDataCon = pcDataCon integerDataConKey pRELUDE SLIT("J#")
248 [] [] [intPrimTy, intPrimTy, byteArrayPrimTy] integerTyCon nullSpecEnv
251 And the other pairing types:
253 return2GMPsTyCon = pcDataTyCon return2GMPsTyConKey
254 gHC__ SLIT("Return2GMPs") [] [return2GMPsDataCon]
257 = pcDataCon return2GMPsDataConKey gHC__ SLIT("Return2GMPs") [] []
258 [intPrimTy, intPrimTy, byteArrayPrimTy,
259 intPrimTy, intPrimTy, byteArrayPrimTy] return2GMPsTyCon nullSpecEnv
261 returnIntAndGMPTyCon = pcDataTyCon returnIntAndGMPTyConKey
262 gHC__ SLIT("ReturnIntAndGMP") [] [returnIntAndGMPDataCon]
264 returnIntAndGMPDataCon
265 = pcDataCon returnIntAndGMPDataConKey gHC__ SLIT("ReturnIntAndGMP") [] []
266 [intPrimTy, intPrimTy, intPrimTy, byteArrayPrimTy] returnIntAndGMPTyCon nullSpecEnv
269 %************************************************************************
271 \subsection[TysWiredIn-state-pairing]{``State-pairing'' types}
273 %************************************************************************
275 These boring types pair a \tr{State#} with another primitive type.
276 They are not really primitive, so they are given here, not in
279 We fish one of these \tr{StateAnd<blah>#} things with
280 @getStatePairingConInfo@ (given a little way down).
284 = pcDataTyCon stateAndPtrPrimTyConKey gHC__ SLIT("StateAndPtr#")
285 alpha_beta_tyvars [stateAndPtrPrimDataCon]
286 stateAndPtrPrimDataCon
287 = pcDataCon stateAndPtrPrimDataConKey gHC__ SLIT("StateAndPtr#")
288 alpha_beta_tyvars [] [mkStatePrimTy alphaTy, betaTy]
289 stateAndPtrPrimTyCon nullSpecEnv
291 stateAndCharPrimTyCon
292 = pcDataTyCon stateAndCharPrimTyConKey gHC__ SLIT("StateAndChar#")
293 alpha_tyvar [stateAndCharPrimDataCon]
294 stateAndCharPrimDataCon
295 = pcDataCon stateAndCharPrimDataConKey gHC__ SLIT("StateAndChar#")
296 alpha_tyvar [] [mkStatePrimTy alphaTy, charPrimTy]
297 stateAndCharPrimTyCon nullSpecEnv
300 = pcDataTyCon stateAndIntPrimTyConKey gHC__ SLIT("StateAndInt#")
301 alpha_tyvar [stateAndIntPrimDataCon]
302 stateAndIntPrimDataCon
303 = pcDataCon stateAndIntPrimDataConKey gHC__ SLIT("StateAndInt#")
304 alpha_tyvar [] [mkStatePrimTy alphaTy, intPrimTy]
305 stateAndIntPrimTyCon nullSpecEnv
307 stateAndWordPrimTyCon
308 = pcDataTyCon stateAndWordPrimTyConKey gHC__ SLIT("StateAndWord#")
309 alpha_tyvar [stateAndWordPrimDataCon]
310 stateAndWordPrimDataCon
311 = pcDataCon stateAndWordPrimDataConKey gHC__ SLIT("StateAndWord#")
312 alpha_tyvar [] [mkStatePrimTy alphaTy, wordPrimTy]
313 stateAndWordPrimTyCon nullSpecEnv
315 stateAndAddrPrimTyCon
316 = pcDataTyCon stateAndAddrPrimTyConKey gHC__ SLIT("StateAndAddr#")
317 alpha_tyvar [stateAndAddrPrimDataCon]
318 stateAndAddrPrimDataCon
319 = pcDataCon stateAndAddrPrimDataConKey gHC__ SLIT("StateAndAddr#")
320 alpha_tyvar [] [mkStatePrimTy alphaTy, addrPrimTy]
321 stateAndAddrPrimTyCon nullSpecEnv
323 stateAndStablePtrPrimTyCon
324 = pcDataTyCon stateAndStablePtrPrimTyConKey gHC__ SLIT("StateAndStablePtr#")
325 alpha_beta_tyvars [stateAndStablePtrPrimDataCon]
326 stateAndStablePtrPrimDataCon
327 = pcDataCon stateAndStablePtrPrimDataConKey gHC__ SLIT("StateAndStablePtr#")
329 [mkStatePrimTy alphaTy, applyTyCon stablePtrPrimTyCon [betaTy]]
330 stateAndStablePtrPrimTyCon nullSpecEnv
332 stateAndForeignObjPrimTyCon
333 = pcDataTyCon stateAndForeignObjPrimTyConKey gHC__ SLIT("StateAndForeignObj#")
334 alpha_tyvar [stateAndForeignObjPrimDataCon]
335 stateAndForeignObjPrimDataCon
336 = pcDataCon stateAndForeignObjPrimDataConKey gHC__ SLIT("StateAndForeignObj#")
338 [mkStatePrimTy alphaTy, applyTyCon foreignObjPrimTyCon []]
339 stateAndForeignObjPrimTyCon nullSpecEnv
341 stateAndFloatPrimTyCon
342 = pcDataTyCon stateAndFloatPrimTyConKey gHC__ SLIT("StateAndFloat#")
343 alpha_tyvar [stateAndFloatPrimDataCon]
344 stateAndFloatPrimDataCon
345 = pcDataCon stateAndFloatPrimDataConKey gHC__ SLIT("StateAndFloat#")
346 alpha_tyvar [] [mkStatePrimTy alphaTy, floatPrimTy]
347 stateAndFloatPrimTyCon nullSpecEnv
349 stateAndDoublePrimTyCon
350 = pcDataTyCon stateAndDoublePrimTyConKey gHC__ SLIT("StateAndDouble#")
351 alpha_tyvar [stateAndDoublePrimDataCon]
352 stateAndDoublePrimDataCon
353 = pcDataCon stateAndDoublePrimDataConKey gHC__ SLIT("StateAndDouble#")
354 alpha_tyvar [] [mkStatePrimTy alphaTy, doublePrimTy]
355 stateAndDoublePrimTyCon nullSpecEnv
359 stateAndArrayPrimTyCon
360 = pcDataTyCon stateAndArrayPrimTyConKey gHC__ SLIT("StateAndArray#")
361 alpha_beta_tyvars [stateAndArrayPrimDataCon]
362 stateAndArrayPrimDataCon
363 = pcDataCon stateAndArrayPrimDataConKey gHC__ SLIT("StateAndArray#")
364 alpha_beta_tyvars [] [mkStatePrimTy alphaTy, mkArrayPrimTy betaTy]
365 stateAndArrayPrimTyCon nullSpecEnv
367 stateAndMutableArrayPrimTyCon
368 = pcDataTyCon stateAndMutableArrayPrimTyConKey gHC__ SLIT("StateAndMutableArray#")
369 alpha_beta_tyvars [stateAndMutableArrayPrimDataCon]
370 stateAndMutableArrayPrimDataCon
371 = pcDataCon stateAndMutableArrayPrimDataConKey gHC__ SLIT("StateAndMutableArray#")
372 alpha_beta_tyvars [] [mkStatePrimTy alphaTy, mkMutableArrayPrimTy alphaTy betaTy]
373 stateAndMutableArrayPrimTyCon nullSpecEnv
375 stateAndByteArrayPrimTyCon
376 = pcDataTyCon stateAndByteArrayPrimTyConKey gHC__ SLIT("StateAndByteArray#")
377 alpha_tyvar [stateAndByteArrayPrimDataCon]
378 stateAndByteArrayPrimDataCon
379 = pcDataCon stateAndByteArrayPrimDataConKey gHC__ SLIT("StateAndByteArray#")
380 alpha_tyvar [] [mkStatePrimTy alphaTy, byteArrayPrimTy]
381 stateAndByteArrayPrimTyCon nullSpecEnv
383 stateAndMutableByteArrayPrimTyCon
384 = pcDataTyCon stateAndMutableByteArrayPrimTyConKey gHC__ SLIT("StateAndMutableByteArray#")
385 alpha_tyvar [stateAndMutableByteArrayPrimDataCon]
386 stateAndMutableByteArrayPrimDataCon
387 = pcDataCon stateAndMutableByteArrayPrimDataConKey gHC__ SLIT("StateAndMutableByteArray#")
388 alpha_tyvar [] [mkStatePrimTy alphaTy, applyTyCon mutableByteArrayPrimTyCon alpha_ty]
389 stateAndMutableByteArrayPrimTyCon nullSpecEnv
391 stateAndSynchVarPrimTyCon
392 = pcDataTyCon stateAndSynchVarPrimTyConKey gHC__ SLIT("StateAndSynchVar#")
393 alpha_beta_tyvars [stateAndSynchVarPrimDataCon]
394 stateAndSynchVarPrimDataCon
395 = pcDataCon stateAndSynchVarPrimDataConKey gHC__ SLIT("StateAndSynchVar#")
396 alpha_beta_tyvars [] [mkStatePrimTy alphaTy, mkSynchVarPrimTy alphaTy betaTy]
397 stateAndSynchVarPrimTyCon nullSpecEnv
400 The ccall-desugaring mechanism uses this function to figure out how to
401 rebox the result. It's really a HACK, especially the part about
402 how many types to drop from \tr{tys_applied}.
405 getStatePairingConInfo
406 :: Type -- primitive type
407 -> (Id, -- state pair constructor for prim type
408 Type) -- type of state pair
410 getStatePairingConInfo prim_ty
411 = case (maybeAppTyCon prim_ty) of
412 Nothing -> panic "getStatePairingConInfo:1"
413 Just (prim_tycon, tys_applied) ->
415 (pair_con, pair_tycon, num_tys) = assoc "getStatePairingConInfo" tbl prim_tycon
416 pair_ty = applyTyCon pair_tycon (realWorldTy : drop num_tys tys_applied)
421 (charPrimTyCon, (stateAndCharPrimDataCon, stateAndCharPrimTyCon, 0)),
422 (intPrimTyCon, (stateAndIntPrimDataCon, stateAndIntPrimTyCon, 0)),
423 (wordPrimTyCon, (stateAndWordPrimDataCon, stateAndWordPrimTyCon, 0)),
424 (addrPrimTyCon, (stateAndAddrPrimDataCon, stateAndAddrPrimTyCon, 0)),
425 (stablePtrPrimTyCon, (stateAndStablePtrPrimDataCon, stateAndStablePtrPrimTyCon, 0)),
426 (foreignObjPrimTyCon, (stateAndForeignObjPrimDataCon, stateAndForeignObjPrimTyCon, 0)),
427 (floatPrimTyCon, (stateAndFloatPrimDataCon, stateAndFloatPrimTyCon, 0)),
428 (doublePrimTyCon, (stateAndDoublePrimDataCon, stateAndDoublePrimTyCon, 0)),
429 (arrayPrimTyCon, (stateAndArrayPrimDataCon, stateAndArrayPrimTyCon, 0)),
430 (mutableArrayPrimTyCon, (stateAndMutableArrayPrimDataCon, stateAndMutableArrayPrimTyCon, 1)),
431 (byteArrayPrimTyCon, (stateAndByteArrayPrimDataCon, stateAndByteArrayPrimTyCon, 0)),
432 (mutableByteArrayPrimTyCon, (stateAndMutableByteArrayPrimDataCon, stateAndMutableByteArrayPrimTyCon, 1)),
433 (synchVarPrimTyCon, (stateAndSynchVarPrimDataCon, stateAndSynchVarPrimTyCon, 1))
434 -- (PtrPrimTyCon, (stateAndPtrPrimDataCon, stateAndPtrPrimTyCon, 0)),
438 %************************************************************************
440 \subsection[TysWiredIn-ST]{The basic @_ST@ state-transformer type}
442 %************************************************************************
444 This is really just an ordinary synonym, except it is ABSTRACT.
447 mkStateTransformerTy s a = applyTyCon stTyCon [s, a]
449 stTyCon = pcNewTyCon stTyConKey gHC__ SLIT("ST") alpha_beta_tyvars [stDataCon]
451 stDataCon = pcDataCon stDataConKey gHC__ SLIT("ST")
452 alpha_beta_tyvars [] [ty] stTyCon nullSpecEnv
454 ty = mkFunTy (mkStateTy alphaTy) (mkTupleTy 2 [betaTy, mkStateTy alphaTy])
457 %************************************************************************
459 \subsection[TysWiredIn-IO]{The @PrimIO@ monadic-I/O type}
461 %************************************************************************
464 mkPrimIoTy a = mkStateTransformerTy realWorldTy a
468 primIoTyConKey gHC__ SLIT("PrimIO")
469 (mkBoxedTypeKind `mkArrowKind` mkBoxedTypeKind)
470 1 alpha_tyvar (mkPrimIoTy alphaTy)
473 %************************************************************************
475 \subsection[TysWiredIn-Bool]{The @Bool@ type}
477 %************************************************************************
479 An ordinary enumeration type, but deeply wired in. There are no
480 magical operations on @Bool@ (just the regular Prelude code).
482 {\em BEGIN IDLE SPECULATION BY SIMON}
484 This is not the only way to encode @Bool@. A more obvious coding makes
485 @Bool@ just a boxed up version of @Bool#@, like this:
488 data Bool = MkBool Bool#
491 Unfortunately, this doesn't correspond to what the Report says @Bool@
492 looks like! Furthermore, we get slightly less efficient code (I
493 think) with this coding. @gtInt@ would look like this:
496 gtInt :: Int -> Int -> Bool
497 gtInt x y = case x of I# x# ->
499 case (gtIntPrim x# y#) of
503 Notice that the result of the @gtIntPrim@ comparison has to be turned
504 into an integer (here called @b#@), and returned in a @MkBool@ box.
506 The @if@ expression would compile to this:
509 MkBool b# -> case b# of { 1# -> e1; 0# -> e2 }
512 I think this code is a little less efficient than the previous code,
513 but I'm not certain. At all events, corresponding with the Report is
514 important. The interesting thing is that the language is expressive
515 enough to describe more than one alternative; and that a type doesn't
516 necessarily need to be a straightforwardly boxed version of its
517 primitive counterpart.
519 {\em END IDLE SPECULATION BY SIMON}
522 boolTy = mkTyConTy boolTyCon
524 boolTyCon = pcDataTyCon boolTyConKey pRELUDE SLIT("Bool") [] [falseDataCon, trueDataCon]
526 falseDataCon = pcDataCon falseDataConKey pRELUDE SLIT("False") [] [] [] boolTyCon nullSpecEnv
527 trueDataCon = pcDataCon trueDataConKey pRELUDE SLIT("True") [] [] [] boolTyCon nullSpecEnv
530 %************************************************************************
532 \subsection[TysWiredIn-List]{The @List@ type (incl ``build'' magic)}
534 %************************************************************************
536 Special syntax, deeply wired in, but otherwise an ordinary algebraic
539 data [] a = [] | a : (List a)
541 data (,) a b = (,,) a b
546 mkListTy :: GenType t u -> GenType t u
547 mkListTy ty = applyTyCon listTyCon [ty]
549 alphaListTy = mkSigmaTy alpha_tyvar [] (applyTyCon listTyCon alpha_ty)
551 listTyCon = pcDataTyCon listTyConKey pRELUDE SLIT("[]")
552 alpha_tyvar [nilDataCon, consDataCon]
554 nilDataCon = pcDataCon nilDataConKey pRELUDE SLIT("[]") alpha_tyvar [] [] listTyCon
555 (pcGenerateDataSpecs alphaListTy)
556 consDataCon = pcDataCon consDataConKey pRELUDE SLIT(":")
557 alpha_tyvar [] [alphaTy, applyTyCon listTyCon alpha_ty] listTyCon
558 (pcGenerateDataSpecs alphaListTy)
559 -- Interesting: polymorphic recursion would help here.
560 -- We can't use (mkListTy alphaTy) in the defn of consDataCon, else mkListTy
561 -- gets the over-specific type (Type -> Type)
564 %************************************************************************
566 \subsection[TysWiredIn-Tuples]{The @Tuple@ types}
568 %************************************************************************
570 The tuple types are definitely magic, because they form an infinite
575 They have a special family of type constructors, of type @TyCon@
576 These contain the tycon arity, but don't require a Unique.
579 They have a special family of constructors, of type
580 @Id@. Again these contain their arity but don't need a Unique.
583 There should be a magic way of generating the info tables and
584 entry code for all tuples.
586 But at the moment we just compile a Haskell source
587 file\srcloc{lib/prelude/...} containing declarations like:
590 data Tuple2 a b = Tup2 a b
591 data Tuple3 a b c = Tup3 a b c
592 data Tuple4 a b c d = Tup4 a b c d
595 The print-names associated with the magic @Id@s for tuple constructors
596 ``just happen'' to be the same as those generated by these
600 The instance environment should have a magic way to know
601 that each tuple type is an instances of classes @Eq@, @Ix@, @Ord@ and
602 so on. \ToDo{Not implemented yet.}
605 There should also be a way to generate the appropriate code for each
606 of these instances, but (like the info tables and entry code) it is
607 done by enumeration\srcloc{lib/prelude/InTup?.hs}.
611 mkTupleTy :: Int -> [GenType t u] -> GenType t u
613 mkTupleTy arity tys = applyTyCon (mkTupleTyCon arity) tys
615 unitTy = mkTupleTy 0 []
618 %************************************************************************
620 \subsection[TysWiredIn-_Lift]{@_Lift@ type: to support array indexing}
622 %************************************************************************
624 Again, deeply turgid: \tr{data _Lift a = _Lift a}.
627 mkLiftTy ty = applyTyCon liftTyCon [ty]
631 = mkSigmaTy tvs theta (applyTyCon liftTyCon [tau])
633 (tvs, theta, tau) = splitSigmaTy ty
636 = case (maybeAppDataTyConExpandingDicts tau) of
637 Just (tycon, tys, _) -> tycon == liftTyCon
640 (tvs, theta, tau) = splitSigmaTy ty
644 alphaLiftTy = mkSigmaTy alpha_tyvar [] (applyTyCon liftTyCon alpha_ty)
647 = pcDataTyCon liftTyConKey gHC__ SLIT("Lift") alpha_tyvar [liftDataCon]
650 = pcDataCon liftDataConKey gHC__ SLIT("Lift")
651 alpha_tyvar [] alpha_ty liftTyCon
652 ((pcGenerateDataSpecs alphaLiftTy) `addOneToSpecEnv`
653 (mkSpecInfo [Just realWorldStatePrimTy] 0 bottom))
655 bottom = panic "liftDataCon:State# _RealWorld"