2 % (c) The AQUA Project, Glasgow University, 1998
4 \section[StdIdInfo]{Standard unfoldings}
6 This module contains definitions for the IdInfo for things that
7 have a standard form, namely:
11 * method and superclass selectors
12 * primitive operations
16 mkSpecPragmaId, mkWorkerId,
18 mkDictFunId, mkDefaultMethodId,
21 mkDataConId, mkDataConWrapId,
23 mkPrimOpId, mkCCallOpId,
25 -- And some particular Ids; see below for why they are wired in
27 unsafeCoerceId, realWorldPrimId,
28 eRROR_ID, rEC_SEL_ERROR_ID, pAT_ERROR_ID, rEC_CON_ERROR_ID,
29 rEC_UPD_ERROR_ID, iRREFUT_PAT_ERROR_ID, nON_EXHAUSTIVE_GUARDS_ERROR_ID,
30 nO_METHOD_BINDING_ERROR_ID, aBSENT_ERROR_ID, pAR_ERROR_ID
33 #include "HsVersions.h"
36 import TysPrim ( openAlphaTyVars, alphaTyVar, alphaTy,
37 intPrimTy, realWorldStatePrimTy
39 import TysWiredIn ( boolTy, charTy, mkListTy )
40 import PrelMods ( pREL_ERR, pREL_GHC )
41 import PrelRules ( primOpRule )
42 import Rules ( addRule )
43 import Type ( Type, ClassContext, mkDictTy, mkTyConApp, mkTyVarTys,
44 mkFunTys, mkFunTy, mkSigmaTy, classesToPreds,
45 isUnLiftedType, mkForAllTys, mkTyVarTy, tyVarsOfType, tyVarsOfTypes,
46 splitSigmaTy, splitFunTy_maybe, splitAlgTyConApp,
47 splitFunTys, splitForAllTys, unUsgTy,
50 import PprType ( pprParendType )
51 import Module ( Module )
52 import CoreUtils ( mkInlineMe )
53 import CoreUnfold ( mkTopUnfolding, mkCompulsoryUnfolding, mkOtherCon )
54 import Subst ( mkTopTyVarSubst, substClasses )
55 import TyCon ( TyCon, isNewTyCon, tyConTyVars, tyConDataCons, isDataTyCon, isProductTyCon, isUnboxedTupleTyCon )
56 import Class ( Class, classBigSig, classTyCon, classTyVars, classSelIds )
57 import Var ( Id, TyVar )
58 import VarSet ( isEmptyVarSet )
59 import Name ( mkDerivedName, mkWiredInIdName, mkLocalName,
60 mkWorkerOcc, mkSuperDictSelOcc, mkCCallName,
63 import OccName ( mkSrcVarOcc )
64 import PrimOp ( PrimOp(DataToTagOp, CCallOp),
65 primOpSig, mkPrimOpIdName,
68 import Demand ( wwStrict, wwPrim )
69 import DataCon ( DataCon, StrictnessMark(..),
70 dataConFieldLabels, dataConRepArity, dataConTyCon,
71 dataConArgTys, dataConRepType, dataConRepStrictness, dataConName,
72 dataConSig, dataConStrictMarks, dataConId
74 import Id ( idType, mkId,
75 mkVanillaId, mkTemplateLocals,
76 mkTemplateLocal, setInlinePragma, idCprInfo
78 import IdInfo ( IdInfo, vanillaIdInfo, mkIdInfo,
79 exactArity, setUnfoldingInfo, setCafInfo, setCprInfo,
80 setArityInfo, setInlinePragInfo, setSpecInfo,
81 mkStrictnessInfo, setStrictnessInfo,
82 IdFlavour(..), InlinePragInfo(..), CafInfo(..), StrictnessInfo(..), CprInfo(..)
84 import FieldLabel ( FieldLabel, FieldLabelTag, mkFieldLabel, fieldLabelName,
85 firstFieldLabelTag, allFieldLabelTags, fieldLabelType
89 import BasicTypes ( Arity )
91 import Maybe ( isJust )
98 %************************************************************************
100 \subsection{Wired in Ids}
102 %************************************************************************
106 = [ -- These error-y things are wired in because we don't yet have
107 -- a way to express in an interface file that the result type variable
108 -- is 'open'; that is can be unified with an unboxed type
110 -- [The interface file format now carry such information, but there's
111 -- no way yet of expressing at the definition site for these error-reporting
112 -- functions that they have an 'open' result type. -- sof 1/99]
116 , iRREFUT_PAT_ERROR_ID
117 , nON_EXHAUSTIVE_GUARDS_ERROR_ID
118 , nO_METHOD_BINDING_ERROR_ID
124 -- These two can't be defined in Haskell
131 %************************************************************************
133 \subsection{Easy ones}
135 %************************************************************************
138 mkSpecPragmaId occ uniq ty loc
139 = mkId (mkLocalName uniq occ loc) ty (mkIdInfo SpecPragmaId)
140 -- Maybe a SysLocal? But then we'd lose the location
142 mkDefaultMethodId dm_name rec_c ty
143 = mkVanillaId dm_name ty
145 mkWorkerId uniq unwrkr ty
146 = mkVanillaId (mkDerivedName mkWorkerOcc (getName unwrkr) uniq) ty
149 %************************************************************************
151 \subsection{Data constructors}
153 %************************************************************************
156 mkDataConId :: Name -> DataCon -> Id
157 -- Makes the *worker* for the data constructor; that is, the function
158 -- that takes the reprsentation arguments and builds the constructor.
159 mkDataConId work_name data_con
160 = mkId work_name (dataConRepType data_con) info
162 info = mkIdInfo (DataConId data_con)
163 `setArityInfo` exactArity arity
164 `setStrictnessInfo` strict_info
165 `setCprInfo` cpr_info
167 arity = dataConRepArity data_con
169 strict_info = StrictnessInfo (dataConRepStrictness data_con) False
171 cpr_info | isProductTyCon tycon &&
172 not (isUnboxedTupleTyCon tycon) &&
173 arity > 0 = ReturnsCPR
174 | otherwise = NoCPRInfo
176 tycon = dataConTyCon data_con
177 -- Newtypes don't have a worker at all
179 -- If we are a product with 0 args we must be void(like)
180 -- We can't create an unboxed tuple with 0 args for this
181 -- and since Void has only one, constant value it should
182 -- just mean returning a pointer to a pre-existing cell.
183 -- So we won't really gain from doing anything fancy
184 -- and we treat this case as Top.
187 The wrapper for a constructor is an ordinary top-level binding that evaluates
188 any strict args, unboxes any args that are going to be flattened, and calls
191 We're going to build a constructor that looks like:
193 data (Data a, C b) => T a b = T1 !a !Int b
196 \d1::Data a, d2::C b ->
197 \p q r -> case p of { p ->
199 Con T1 [a,b] [p,q,r]}}
203 * d2 is thrown away --- a context in a data decl is used to make sure
204 one *could* construct dictionaries at the site the constructor
205 is used, but the dictionary isn't actually used.
207 * We have to check that we can construct Data dictionaries for
208 the types a and Int. Once we've done that we can throw d1 away too.
210 * We use (case p of q -> ...) to evaluate p, rather than "seq" because
211 all that matters is that the arguments are evaluated. "seq" is
212 very careful to preserve evaluation order, which we don't need
215 You might think that we could simply give constructors some strictness
216 info, like PrimOps, and let CoreToStg do the let-to-case transformation.
217 But we don't do that because in the case of primops and functions strictness
218 is a *property* not a *requirement*. In the case of constructors we need to
219 do something active to evaluate the argument.
221 Making an explicit case expression allows the simplifier to eliminate
222 it in the (common) case where the constructor arg is already evaluated.
225 mkDataConWrapId data_con
228 wrap_id = mkId (dataConName data_con) wrap_ty info
229 work_id = dataConId data_con
231 info = mkIdInfo (DataConWrapId data_con)
232 `setUnfoldingInfo` mkTopUnfolding cpr_info (mkInlineMe wrap_rhs)
233 `setCprInfo` cpr_info
234 -- The Cpr info can be important inside INLINE rhss, where the
235 -- wrapper constructor isn't inlined
236 `setArityInfo` exactArity arity
237 -- It's important to specify the arity, so that partial
238 -- applications are treated as values
239 `setCafInfo` NoCafRefs
240 -- The wrapper Id ends up in STG code as an argument,
241 -- sometimes before its definition, so we want to
242 -- signal that it has no CAFs
244 wrap_ty = mkForAllTys all_tyvars $
248 cpr_info = idCprInfo work_id
250 wrap_rhs | isNewTyCon tycon
251 = ASSERT( null ex_tyvars && null ex_dict_args && length orig_arg_tys == 1 )
252 -- No existentials on a newtype, but it can have a contex
253 -- e.g. newtype Eq a => T a = MkT (...)
255 mkLams tyvars $ mkLams dict_args $ Lam id_arg1 $
256 Note (Coerce result_ty (head orig_arg_tys)) (Var id_arg1)
258 {- I nuked this because map (:) xs would create a
259 new local lambda for the (:) in core-to-stg.
260 There isn't a defn for the worker!
262 | null dict_args && all not_marked_strict strict_marks
263 = Var work_id -- The common case. Not only is this efficient,
264 -- but it also ensures that the wrapper is replaced
265 -- by the worker even when there are no args.
269 -- This is really important in rule matching,
270 -- which is a bit sad. (We could match on the wrappers,
271 -- but that makes it less likely that rules will match
272 -- when we bring bits of unfoldings together
276 = mkLams all_tyvars $ mkLams dict_args $
277 mkLams ex_dict_args $ mkLams id_args $
278 foldr mk_case con_app
279 (zip (ex_dict_args++id_args) strict_marks) i3 []
281 con_app i rep_ids = mkApps (Var work_id)
282 (map varToCoreExpr (all_tyvars ++ reverse rep_ids))
284 (tyvars, theta, ex_tyvars, ex_theta, orig_arg_tys, tycon) = dataConSig data_con
285 all_tyvars = tyvars ++ ex_tyvars
287 dict_tys = [mkDictTy clas tys | (clas,tys) <- theta]
288 ex_dict_tys = [mkDictTy clas tys | (clas,tys) <- ex_theta]
289 all_arg_tys = dict_tys ++ ex_dict_tys ++ orig_arg_tys
290 result_ty = mkTyConApp tycon (mkTyVarTys tyvars)
292 mkLocals i tys = (zipWith mkTemplateLocal [i..i+n-1] tys, i+n)
296 (dict_args, i1) = mkLocals 1 dict_tys
297 (ex_dict_args,i2) = mkLocals i1 ex_dict_tys
298 (id_args,i3) = mkLocals i2 orig_arg_tys
300 (id_arg1:_) = id_args -- Used for newtype only
302 strict_marks = dataConStrictMarks data_con
303 not_marked_strict NotMarkedStrict = True
304 not_marked_strict other = False
308 :: (Id, StrictnessMark) -- arg, strictness
309 -> (Int -> [Id] -> CoreExpr) -- body
310 -> Int -- next rep arg id
311 -> [Id] -- rep args so far
313 mk_case (arg,strict) body i rep_args
315 NotMarkedStrict -> body i (arg:rep_args)
317 | isUnLiftedType (idType arg) -> body i (arg:rep_args)
319 Case (Var arg) arg [(DEFAULT,[], body i (arg:rep_args))]
321 MarkedUnboxed con tys ->
322 Case (Var arg) arg [(DataAlt con, con_args,
323 body i' (reverse con_args++rep_args))]
324 where n_tys = length tys
325 (con_args,i') = mkLocals i tys
329 %************************************************************************
331 \subsection{Record selectors}
333 %************************************************************************
335 We're going to build a record selector unfolding that looks like this:
337 data T a b c = T1 { ..., op :: a, ...}
338 | T2 { ..., op :: a, ...}
341 sel = /\ a b c -> \ d -> case d of
347 mkRecordSelId tycon field_label
348 -- Assumes that all fields with the same field label
349 -- have the same type
352 sel_id = mkId (fieldLabelName field_label) selector_ty info
354 field_ty = fieldLabelType field_label
355 field_name = fieldLabelName field_label
356 data_cons = tyConDataCons tycon
357 tyvars = tyConTyVars tycon -- These scope over the types in
358 -- the FieldLabels of constructors of this type
360 data_ty = mkTyConApp tycon (mkTyVarTys tyvars)
361 tyvar_tys = mkTyVarTys tyvars
364 selector_ty = mkForAllTys tyvars (mkFunTy data_ty field_ty)
366 info = mkIdInfo (RecordSelId field_label)
367 `setArityInfo` exactArity 1
368 `setUnfoldingInfo` unfolding
369 `setCafInfo` NoCafRefs
370 -- ToDo: consider adding further IdInfo
372 unfolding = mkTopUnfolding NoCPRInfo sel_rhs
375 [data_id] = mkTemplateLocals [data_ty]
376 alts = map mk_maybe_alt data_cons
377 the_alts = catMaybes alts
378 default_alt | all isJust alts = [] -- No default needed
379 | otherwise = [(DEFAULT, [], error_expr)]
381 sel_rhs | isNewTyCon tycon = new_sel_rhs
382 | otherwise = data_sel_rhs
384 data_sel_rhs = mkLams tyvars $ Lam data_id $
385 Case (Var data_id) data_id (the_alts ++ default_alt)
387 new_sel_rhs = mkLams tyvars $ Lam data_id $
388 Note (Coerce (unUsgTy field_ty) (unUsgTy data_ty)) (Var data_id)
390 mk_maybe_alt data_con
391 = case maybe_the_arg_id of
393 Just the_arg_id -> Just (DataAlt data_con, arg_ids, Var the_arg_id)
395 arg_ids = mkTemplateLocals (dataConArgTys data_con tyvar_tys)
396 -- The first one will shadow data_id, but who cares
397 field_lbls = dataConFieldLabels data_con
398 maybe_the_arg_id = assocMaybe (field_lbls `zip` arg_ids) field_label
400 error_expr = mkApps (Var rEC_SEL_ERROR_ID) [Type (unUsgTy field_ty), mkStringLit full_msg]
401 -- preserves invariant that type args are *not* usage-annotated on top. KSW 1999-04.
402 full_msg = showSDoc (sep [text "No match in record selector", ppr sel_id])
406 %************************************************************************
408 \subsection{Dictionary selectors}
410 %************************************************************************
412 Selecting a field for a dictionary. If there is just one field, then
413 there's nothing to do.
415 ToDo: unify with mkRecordSelId.
418 mkDictSelId name clas ty
421 sel_id = mkId name ty info
422 field_lbl = mkFieldLabel name ty tag
423 tag = assoc "MkId.mkDictSelId" (classSelIds clas `zip` allFieldLabelTags) sel_id
425 info = mkIdInfo (RecordSelId field_lbl)
426 `setArityInfo` exactArity 1
427 `setUnfoldingInfo` unfolding
428 `setCafInfo` NoCafRefs
430 -- We no longer use 'must-inline' on record selectors. They'll
431 -- inline like crazy if they scrutinise a constructor
433 unfolding = mkTopUnfolding NoCPRInfo rhs
435 tyvars = classTyVars clas
437 tycon = classTyCon clas
438 [data_con] = tyConDataCons tycon
439 tyvar_tys = mkTyVarTys tyvars
440 arg_tys = dataConArgTys data_con tyvar_tys
441 the_arg_id = arg_ids !! (tag - firstFieldLabelTag)
443 dict_ty = mkDictTy clas tyvar_tys
444 (dict_id:arg_ids) = mkTemplateLocals (dict_ty : arg_tys)
446 rhs | isNewTyCon tycon = mkLams tyvars $ Lam dict_id $
447 Note (Coerce (head arg_tys) dict_ty) (Var dict_id)
448 | otherwise = mkLams tyvars $ Lam dict_id $
449 Case (Var dict_id) dict_id
450 [(DataAlt data_con, arg_ids, Var the_arg_id)]
454 %************************************************************************
456 \subsection{Primitive operations
458 %************************************************************************
461 mkPrimOpId :: PrimOp -> Id
465 (tyvars,arg_tys,res_ty, arity, strict_info) = primOpSig prim_op
466 ty = mkForAllTys tyvars (mkFunTys arg_tys res_ty)
467 name = mkPrimOpIdName prim_op id
468 id = mkId name ty info
470 info = mkIdInfo (PrimOpId prim_op)
472 `setArityInfo` exactArity arity
473 `setStrictnessInfo` strict_info
475 rules = addRule id emptyCoreRules (primOpRule prim_op)
478 -- For each ccall we manufacture a separate CCallOpId, giving it
479 -- a fresh unique, a type that is correct for this particular ccall,
480 -- and a CCall structure that gives the correct details about calling
483 -- The *name* of this Id is a local name whose OccName gives the full
484 -- details of the ccall, type and all. This means that the interface
485 -- file reader can reconstruct a suitable Id
487 mkCCallOpId :: Unique -> CCall -> Type -> Id
488 mkCCallOpId uniq ccall ty
489 = ASSERT( isEmptyVarSet (tyVarsOfType ty) )
490 -- A CCallOpId should have no free type variables;
491 -- when doing substitutions won't substitute over it
494 occ_str = showSDocIface (braces (pprCCallOp ccall <+> ppr ty))
495 -- The "occurrence name" of a ccall is the full info about the
496 -- ccall; it is encoded, but may have embedded spaces etc!
498 name = mkCCallName uniq occ_str
499 prim_op = CCallOp ccall
501 info = mkIdInfo (PrimOpId prim_op)
502 `setArityInfo` exactArity arity
503 `setStrictnessInfo` strict_info
505 (_, tau) = splitForAllTys ty
506 (arg_tys, _) = splitFunTys tau
507 arity = length arg_tys
508 strict_info = mkStrictnessInfo (take arity (repeat wwPrim), False)
512 %************************************************************************
514 \subsection{DictFuns}
516 %************************************************************************
519 mkDictFunId :: Name -- Name to use for the dict fun;
526 mkDictFunId dfun_name clas inst_tyvars inst_tys inst_decl_theta
527 = mkVanillaId dfun_name dfun_ty
529 (class_tyvars, sc_theta, _, _) = classBigSig clas
530 sc_theta' = substClasses (mkTopTyVarSubst class_tyvars inst_tys) sc_theta
532 dfun_theta = classesToPreds inst_decl_theta
534 {- 1 dec 99: disable the Mark Jones optimisation for the sake
535 of compatibility with Hugs.
536 See `types/InstEnv' for a discussion related to this.
538 dfun_theta = case inst_decl_theta of
539 [] -> [] -- If inst_decl_theta is empty, then we don't
540 -- want to have any dict arguments, so that we can
541 -- expose the constant methods.
543 other -> nub (inst_decl_theta ++ filter not_const sc_theta')
544 -- Otherwise we pass the superclass dictionaries to
545 -- the dictionary function; the Mark Jones optimisation.
547 -- NOTE the "nub". I got caught by this one:
548 -- class Monad m => MonadT t m where ...
549 -- instance Monad m => MonadT (EnvT env) m where ...
550 -- Here, the inst_decl_theta has (Monad m); but so
551 -- does the sc_theta'!
553 -- NOTE the "not_const". I got caught by this one too:
554 -- class Foo a => Baz a b where ...
555 -- instance Wob b => Baz T b where..
556 -- Now sc_theta' has Foo T
558 dfun_ty = mkSigmaTy inst_tyvars dfun_theta (mkDictTy clas inst_tys)
560 not_const (clas, tys) = not (isEmptyVarSet (tyVarsOfTypes tys))
564 %************************************************************************
566 \subsection{Un-definable}
568 %************************************************************************
570 These two can't be defined in Haskell.
572 unsafeCoerce# isn't so much a PrimOp as a phantom identifier, that
573 just gets expanded into a type coercion wherever it occurs. Hence we
574 add it as a built-in Id with an unfolding here.
576 The type variables we use here are "open" type variables: this means
577 they can unify with both unlifted and lifted types. Hence we provide
578 another gun with which to shoot yourself in the foot.
582 = pcMiscPrelId unsafeCoerceIdKey pREL_GHC SLIT("unsafeCoerce#") ty info
585 `setUnfoldingInfo` mkCompulsoryUnfolding rhs
588 ty = mkForAllTys [openAlphaTyVar,openBetaTyVar]
589 (mkFunTy openAlphaTy openBetaTy)
590 [x] = mkTemplateLocals [openAlphaTy]
591 rhs = mkLams [openAlphaTyVar,openBetaTyVar,x] $
592 Note (Coerce openBetaTy openAlphaTy) (Var x)
596 @getTag#@ is another function which can't be defined in Haskell. It needs to
597 evaluate its argument and call the dataToTag# primitive.
601 = pcMiscPrelId getTagIdKey pREL_GHC SLIT("getTag#") ty info
604 `setUnfoldingInfo` mkCompulsoryUnfolding rhs
605 -- We don't provide a defn for this; you must inline it
607 ty = mkForAllTys [alphaTyVar] (mkFunTy alphaTy intPrimTy)
608 [x,y] = mkTemplateLocals [alphaTy,alphaTy]
609 rhs = mkLams [alphaTyVar,x] $
610 Case (Var x) y [ (DEFAULT, [], mkApps (Var dataToTagId) [Type alphaTy, Var y]) ]
612 dataToTagId = mkPrimOpId DataToTagOp
615 @realWorld#@ used to be a magic literal, \tr{void#}. If things get
616 nasty as-is, change it back to a literal (@Literal@).
619 realWorldPrimId -- :: State# RealWorld
620 = pcMiscPrelId realWorldPrimIdKey pREL_GHC SLIT("realWorld#")
622 (noCafIdInfo `setUnfoldingInfo` mkOtherCon [])
623 -- The mkOtherCon makes it look that realWorld# is evaluated
624 -- which in turn makes Simplify.interestingArg return True,
625 -- which in turn makes INLINE things applied to realWorld# likely
630 %************************************************************************
632 \subsection[PrelVals-error-related]{@error@ and friends; @trace@}
634 %************************************************************************
636 GHC randomly injects these into the code.
638 @patError@ is just a version of @error@ for pattern-matching
639 failures. It knows various ``codes'' which expand to longer
640 strings---this saves space!
642 @absentErr@ is a thing we put in for ``absent'' arguments. They jolly
643 well shouldn't be yanked on, but if one is, then you will get a
644 friendly message from @absentErr@ (rather than a totally random
647 @parError@ is a special version of @error@ which the compiler does
648 not know to be a bottoming Id. It is used in the @_par_@ and @_seq_@
649 templates, but we don't ever expect to generate code for it.
653 = pc_bottoming_Id errorIdKey pREL_ERR SLIT("error") errorTy
655 = generic_ERROR_ID recSelErrIdKey SLIT("patError")
657 = generic_ERROR_ID patErrorIdKey SLIT("patError")
659 = generic_ERROR_ID recConErrorIdKey SLIT("recConError")
661 = generic_ERROR_ID recUpdErrorIdKey SLIT("recUpdError")
663 = generic_ERROR_ID irrefutPatErrorIdKey SLIT("irrefutPatError")
664 nON_EXHAUSTIVE_GUARDS_ERROR_ID
665 = generic_ERROR_ID nonExhaustiveGuardsErrorIdKey SLIT("nonExhaustiveGuardsError")
666 nO_METHOD_BINDING_ERROR_ID
667 = generic_ERROR_ID noMethodBindingErrorIdKey SLIT("noMethodBindingError")
670 = pc_bottoming_Id absentErrorIdKey pREL_ERR SLIT("absentErr")
671 (mkSigmaTy [openAlphaTyVar] [] openAlphaTy)
674 = pcMiscPrelId parErrorIdKey pREL_ERR SLIT("parError")
675 (mkSigmaTy [openAlphaTyVar] [] openAlphaTy) noCafIdInfo
680 %************************************************************************
682 \subsection{Utilities}
684 %************************************************************************
687 pcMiscPrelId :: Unique{-IdKey-} -> Module -> FAST_STRING -> Type -> IdInfo -> Id
688 pcMiscPrelId key mod str ty info
690 name = mkWiredInIdName key mod (mkSrcVarOcc str) imp
691 imp = mkId name ty info -- the usual case...
694 -- We lie and say the thing is imported; otherwise, we get into
695 -- a mess with dependency analysis; e.g., core2stg may heave in
696 -- random calls to GHCbase.unpackPS__. If GHCbase is the module
697 -- being compiled, then it's just a matter of luck if the definition
698 -- will be in "the right place" to be in scope.
700 pc_bottoming_Id key mod name ty
701 = pcMiscPrelId key mod name ty bottoming_info
703 bottoming_info = noCafIdInfo
704 `setStrictnessInfo` mkStrictnessInfo ([wwStrict], True)
706 -- these "bottom" out, no matter what their arguments
708 generic_ERROR_ID u n = pc_bottoming_Id u pREL_ERR n errorTy
711 noCafIdInfo = vanillaIdInfo `setCafInfo` NoCafRefs
713 (openAlphaTyVar:openBetaTyVar:_) = openAlphaTyVars
714 openAlphaTy = mkTyVarTy openAlphaTyVar
715 openBetaTy = mkTyVarTy openBetaTyVar
718 errorTy = mkUsgTy UsMany $
719 mkSigmaTy [openAlphaTyVar] [] (mkFunTys [mkUsgTy UsOnce (mkListTy charTy)]
720 (mkUsgTy UsMany openAlphaTy))
721 -- Notice the openAlphaTyVar. It says that "error" can be applied
722 -- to unboxed as well as boxed types. This is OK because it never
723 -- returns, so the return type is irrelevant.