Commit 96152229 authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc

parents 9224e48e ba8fd081
......@@ -229,7 +229,8 @@ make_lit dflags l =
MachWord64 i -> C.Lint i t
MachFloat r -> C.Lrational r t
MachDouble r -> C.Lrational r t
_ -> error "MkExternalCore died: make_lit"
LitInteger i _ -> C.Lint i t
_ -> pprPanic "MkExternalCore died: make_lit" (ppr l)
where
t = make_ty dflags (literalType l)
......
......@@ -772,7 +772,7 @@ dynLinkObjs dflags pls objs = do
mapM_ loadObj (map nameOfObject unlinkeds)
-- Link the all together
-- Link them all together
ok <- resolveObjs
-- If resolving failed, unload all our
......
......@@ -67,56 +67,102 @@ unarise us binds = zipWith (\us -> unariseBinding us init_env) (listSplitUniqSup
unariseBinding :: UniqSupply -> UnariseEnv -> StgBinding -> StgBinding
unariseBinding us rho bind = case bind of
StgNonRec x rhs -> StgNonRec x (unariseRhs us rho rhs)
StgRec xrhss -> StgRec $ zipWith (\us (x, rhs) -> (x, unariseRhs us rho rhs)) (listSplitUniqSupply us) xrhss
StgRec xrhss -> StgRec $ zipWith (\us (x, rhs) -> (x, unariseRhs us rho rhs))
(listSplitUniqSupply us) xrhss
unariseRhs :: UniqSupply -> UnariseEnv -> StgRhs -> StgRhs
unariseRhs us rho rhs = case rhs of
StgRhsClosure ccs b_info fvs update_flag srt args expr
-> StgRhsClosure ccs b_info (unariseIds rho fvs) update_flag (unariseSRT rho srt) args' (unariseExpr us' rho' expr)
-> StgRhsClosure ccs b_info (unariseIds rho fvs) update_flag
(unariseSRT rho srt) args' (unariseExpr us' rho' expr)
where (us', rho', args') = unariseIdBinders us rho args
StgRhsCon ccs con args
-> StgRhsCon ccs con (unariseArgs rho args)
------------------------
unariseExpr :: UniqSupply -> UnariseEnv -> StgExpr -> StgExpr
unariseExpr us rho e = case e of
-- Particularly important where (##) is concerned (Note [The nullary (# #) constructor])
StgApp f [] | UbxTupleRep tys <- repType (idType f)
-> StgConApp (tupleCon UnboxedTuple (length tys)) (map StgVarArg (unariseId rho f))
StgApp f args -> StgApp f (unariseArgs rho args)
StgLit l -> StgLit l
StgConApp dc args | isUnboxedTupleCon dc -> StgConApp (tupleCon UnboxedTuple (length args')) args'
| otherwise -> StgConApp dc args'
where args' = unariseArgs rho args
StgOpApp op args ty -> StgOpApp op (unariseArgs rho args) ty
StgLam xs e -> StgLam xs' (unariseExpr us' rho' e)
where (us', rho', xs') = unariseIdBinders us rho xs
StgCase e case_lives alts_lives bndr srt alt_ty alts
-> StgCase (unariseExpr us1 rho e) (unariseLives rho case_lives) (unariseLives rho alts_lives) bndr (unariseSRT rho srt) alt_ty' alts'
where (us1, us2) = splitUniqSupply us
(alt_ty', alts') = case repType (idType bndr) of
UbxTupleRep tys -> case alts of
(DEFAULT, [], [], e):_ -> (UbxTupAlt n, [(DataAlt (tupleCon UnboxedTuple n), ys, uses, unariseExpr us2' rho' e)])
where (us2', rho', ys) = unariseIdBinder us2 rho bndr
uses = replicate (length ys) (not (isDeadBinder bndr))
n = length tys
[(DataAlt _, ys, uses, e)] -> (UbxTupAlt n, [(DataAlt (tupleCon UnboxedTuple n), ys', uses', unariseExpr us2' rho'' e)])
where (us2', rho', ys', uses') = unariseUsedIdBinders us2 rho ys uses
rho'' = extendVarEnv rho' bndr ys'
n = length ys'
_ -> panic "unariseExpr: strange unboxed tuple alts"
UnaryRep _ -> (alt_ty, zipWith (\us alt -> unariseAlt us rho alt) (listSplitUniqSupply us2) alts)
StgLet bind e -> StgLet (unariseBinding us1 rho bind) (unariseExpr us2 rho e)
where (us1, us2) = splitUniqSupply us
StgLetNoEscape live_in_let live_in_bind bind e
-> StgLetNoEscape (unariseLives rho live_in_let) (unariseLives rho live_in_bind) (unariseBinding us1 rho bind) (unariseExpr us2 rho e)
where (us1, us2) = splitUniqSupply us
StgSCC cc bump_entry push_cc e -> StgSCC cc bump_entry push_cc (unariseExpr us rho e)
StgTick mod tick_n e -> StgTick mod tick_n (unariseExpr us rho e)
unariseExpr _ rho (StgApp f args)
| null args
, UbxTupleRep tys <- repType (idType f)
= -- Particularly important where (##) is concerned
-- See Note [Nullary unboxed tuple]
StgConApp (tupleCon UnboxedTuple (length tys))
(map StgVarArg (unariseId rho f))
| otherwise
= StgApp f (unariseArgs rho args)
unariseExpr _ _ (StgLit l)
= StgLit l
unariseExpr _ rho (StgConApp dc args)
| isUnboxedTupleCon dc = StgConApp (tupleCon UnboxedTuple (length args')) args'
| otherwise = StgConApp dc args'
where
args' = unariseArgs rho args
unariseExpr _ rho (StgOpApp op args ty)
= StgOpApp op (unariseArgs rho args) ty
unariseExpr us rho (StgLam xs e)
= StgLam xs' (unariseExpr us' rho' e)
where
(us', rho', xs') = unariseIdBinders us rho xs
unariseExpr us rho (StgCase e case_lives alts_lives bndr srt alt_ty alts)
= StgCase (unariseExpr us1 rho e) (unariseLives rho case_lives)
(unariseLives rho alts_lives) bndr (unariseSRT rho srt)
alt_ty' alts'
where
(us1, us2) = splitUniqSupply us
(alt_ty', alts') = unariseAlts us2 rho alt_ty bndr (repType (idType bndr)) alts
unariseExpr us rho (StgLet bind e)
= StgLet (unariseBinding us1 rho bind) (unariseExpr us2 rho e)
where
(us1, us2) = splitUniqSupply us
unariseExpr us rho (StgLetNoEscape live_in_let live_in_bind bind e)
= StgLetNoEscape (unariseLives rho live_in_let) (unariseLives rho live_in_bind)
(unariseBinding us1 rho bind) (unariseExpr us2 rho e)
where
(us1, us2) = splitUniqSupply us
unariseExpr us rho (StgSCC cc bump_entry push_cc e)
= StgSCC cc bump_entry push_cc (unariseExpr us rho e)
unariseExpr us rho (StgTick mod tick_n e)
= StgTick mod tick_n (unariseExpr us rho e)
------------------------
unariseAlts :: UniqSupply -> UnariseEnv -> AltType -> Id -> RepType -> [StgAlt] -> (AltType, [StgAlt])
unariseAlts us rho alt_ty _ (UnaryRep _) alts
= (alt_ty, zipWith (\us alt -> unariseAlt us rho alt) (listSplitUniqSupply us) alts)
unariseAlts us rho _ bndr (UbxTupleRep tys) ((DEFAULT, [], [], e) : _)
= (UbxTupAlt n, [(DataAlt (tupleCon UnboxedTuple n), ys, uses, unariseExpr us2' rho' e)])
where
(us2', rho', ys) = unariseIdBinder us rho bndr
uses = replicate (length ys) (not (isDeadBinder bndr))
n = length tys
unariseAlts us rho _ bndr (UbxTupleRep _) [(DataAlt _, ys, uses, e)]
= (UbxTupAlt n, [(DataAlt (tupleCon UnboxedTuple n), ys', uses', unariseExpr us2' rho'' e)])
where
(us2', rho', ys', uses') = unariseUsedIdBinders us rho ys uses
rho'' = extendVarEnv rho' bndr ys'
n = length ys'
unariseAlts _ _ _ _ (UbxTupleRep _) alts
= pprPanic "unariseExpr: strange unboxed tuple alts" (ppr alts)
--------------------------
unariseAlt :: UniqSupply -> UnariseEnv -> StgAlt -> StgAlt
unariseAlt us rho (con, xs, uses, e) = (con, xs', uses', unariseExpr us' rho' e)
where (us', rho', xs', uses') = unariseUsedIdBinders us rho xs uses
unariseAlt us rho (con, xs, uses, e)
= (con, xs', uses', unariseExpr us' rho' e)
where
(us', rho', xs', uses') = unariseUsedIdBinders us rho xs uses
------------------------
unariseSRT :: UnariseEnv -> SRT -> SRT
unariseSRT _ NoSRT = NoSRT
unariseSRT rho (SRTEntries ids) = SRTEntries (concatMapVarSet (unariseId rho) ids)
......@@ -136,16 +182,24 @@ unariseIds :: UnariseEnv -> [Id] -> [Id]
unariseIds rho = concatMap (unariseId rho)
unariseId :: UnariseEnv -> Id -> [Id]
unariseId rho x = case lookupVarEnv rho x of
Just ys -> ASSERT2(case repType (idType x) of UbxTupleRep _ -> True; _ -> x == ubxTupleId0, text "unariseId: not unboxed tuple" <+> ppr x)
ys
Nothing -> ASSERT2(case repType (idType x) of UbxTupleRep _ -> False; _ -> True, text "unariseId: was unboxed tuple" <+> ppr x)
[x]
unariseUsedIdBinders :: UniqSupply -> UnariseEnv -> [Id] -> [Bool] -> (UniqSupply, UnariseEnv, [Id], [Bool])
unariseUsedIdBinders us rho xs uses = case mapAccumL2 (\us rho (x, use) -> third3 (map (flip (,) use)) $ unariseIdBinder us rho x)
us rho (zipEqual "unariseUsedIdBinders" xs uses) of
(us', rho', xs_usess) -> uncurry ((,,,) us' rho') (unzip (concat xs_usess))
unariseId rho x
| Just ys <- lookupVarEnv rho x
= ASSERT2( case repType (idType x) of UbxTupleRep _ -> True; _ -> x == ubxTupleId0
, text "unariseId: not unboxed tuple" <+> ppr x )
ys
| otherwise
= ASSERT2( case repType (idType x) of UbxTupleRep _ -> False; _ -> True
, text "unariseId: was unboxed tuple" <+> ppr x )
[x]
unariseUsedIdBinders :: UniqSupply -> UnariseEnv -> [Id] -> [Bool]
-> (UniqSupply, UnariseEnv, [Id], [Bool])
unariseUsedIdBinders us rho xs uses
= case mapAccumL2 do_one us rho (zipEqual "unariseUsedIdBinders" xs uses) of
(us', rho', xs_usess) -> uncurry ((,,,) us' rho') (unzip (concat xs_usess))
where
do_one us rho (x, use) = third3 (map (flip (,) use)) (unariseIdBinder us rho x)
unariseIdBinders :: UniqSupply -> UnariseEnv -> [Id] -> (UniqSupply, UnariseEnv, [Id])
unariseIdBinders us rho xs = third3 concat $ mapAccumL2 unariseIdBinder us rho xs
......
......@@ -36,6 +36,7 @@ import Maybes ( maybeToBool )
import Name ( getOccName, isExternalName, nameOccName )
import OccName ( occNameString, occNameFS )
import BasicTypes ( Arity )
import TysWiredIn ( unboxedUnitDataCon )
import Literal
import Outputable
import MonadUtils
......@@ -420,6 +421,14 @@ coreToStgExpr (Case scrut bndr _ alts) = do
)
where
vars_alt (con, binders, rhs)
| DataAlt c <- con, c == unboxedUnitDataCon
= -- This case is a bit smelly.
-- See Note [Nullary unboxed tuple] in Type.lhs
-- where a nullary tuple is mapped to (State# World#)
ASSERT( null binders )
do { (rhs2, rhs_fvs, rhs_escs) <- coreToStgExpr rhs
; return ((DEFAULT, [], [], rhs2), rhs_fvs, rhs_escs) }
| otherwise
= let -- Remove type variables
binders' = filterStgBinders binders
in
......@@ -463,7 +472,7 @@ mkStgAltType bndr alts = case repType (idType bndr) of
PolyAlt
Nothing -> PolyAlt
UbxTupleRep rep_tys -> UbxTupAlt (length rep_tys)
-- NB Nullary unboxed tuples have UnaryRep, and generate a PrimAlt
where
_is_poly_alt_tycon tc
= isFunTyCon tc
......
......@@ -492,27 +492,26 @@ data EvLit
Note [Coercion evidence terms]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An evidence term for a coercion, of type (t1 ~ t2), always takes one of
these forms:
co_tm ::= EvId v
A "coercion evidence term" takes one of these forms
co_tm ::= EvId v where v :: t1 ~ t2
| EvCoercion co
| EvCast co_tm co
An alternative would be
* To establish the invariant that coercions are represented only
by EvCoercion
* To maintain the invariant by smart constructors. Eg
mkEvCast (EvCoercion c1) c2 = EvCoercion (TcCastCo c1 c2)
mkEvCast t c = EvCast t c
I don't think it matters much... but maybe we'll find a good reason to
do one or the other. But currently we allow any of the three forms.
We do quite often need to get a TcCoercion from an EvTerm; see
'evTermCoercion'.
INVARIANT: The evidence for any constraint with type (t1~t2) is
a coercion evidence term. Consider for example
[G] g :: F Int a
If we have
ax7 a :: F Int a ~ (a ~ Bool)
then we do NOT generate the constraint
[G} (g |> ax7 a) :: a ~ Bool
because that does not satisfy the invariant. Instead we make a binding
g1 :: a~Bool = g |> ax7 a
and the constraint
[G] g1 :: a~Bool
See Trac [7238]
Note [EvKindCast]
~~~~~~~~~~~~~~~~~
......
......@@ -570,7 +570,12 @@ tcTyVar name -- Could be a tyvar, a tycon, or a datacon
; thing <- tcLookup name
; traceTc "lk2" (ppr name <+> ppr thing)
; case thing of
ATyVar _ tv -> return (mkTyVarTy tv, tyVarKind tv)
ATyVar _ tv
| isKindVar tv
-> failWithTc (ptext (sLit "Kind variable") <+> quotes (ppr tv)
<+> ptext (sLit "used as a type"))
| otherwise
-> return (mkTyVarTy tv, tyVarKind tv)
AThing kind -> do { tc <- get_loopy_tc name
; inst_tycon (mkNakedTyConApp tc) kind }
......@@ -1352,7 +1357,7 @@ tc_lhs_kind (L span ki) = setSrcSpan span (tc_hs_kind ki)
-- The main worker
tc_hs_kind :: HsKind Name -> TcM Kind
tc_hs_kind k@(HsTyVar _) = tc_kind_app k []
tc_hs_kind (HsTyVar tc) = tc_kind_var_app tc []
tc_hs_kind k@(HsAppTy _ _) = tc_kind_app k []
tc_hs_kind (HsParTy ki) = tc_lhs_kind ki
......
......@@ -113,7 +113,7 @@ import Data.List ( (\\), partition, mapAccumL )
\begin{code}
newMetaKindVar :: TcM TcKind
newMetaKindVar = do { uniq <- newUnique
newMetaKindVar = do { uniq <- newMetaUnique
; ref <- newMutVar Flexi
; return (mkTyVarTy (mkMetaKindVar uniq ref)) }
......@@ -593,14 +593,17 @@ skolemiseSigTv tv
\begin{code}
zonkImplication :: Implication -> TcM Implication
zonkImplication implic@(Implic { ic_given = given
zonkImplication implic@(Implic { ic_skols = skols
, ic_given = given
, ic_wanted = wanted
, ic_loc = loc })
= do { -- No need to zonk the skolems
= do { skols' <- mapM zonkTcTyVarBndr skols -- Need to zonk their kinds!
-- as Trac #7230 showed
; given' <- mapM zonkEvVar given
; loc' <- zonkGivenLoc loc
; wanted' <- zonkWC wanted
; return (implic { ic_given = given'
; return (implic { ic_skols = skols'
, ic_given = given'
, ic_wanted = wanted'
, ic_loc = loc' }) }
......@@ -765,10 +768,18 @@ zonkTcType ty
| otherwise = TyVarTy <$> updateTyVarKindM go tyvar
-- Ordinary (non Tc) tyvars occur inside quantified types
go (ForAllTy tyvar ty) = ASSERT2( isImmutableTyVar tyvar, ppr tyvar ) do
ty' <- go ty
tyvar' <- updateTyVarKindM go tyvar
return (ForAllTy tyvar' ty')
go (ForAllTy tv ty) = do { tv' <- zonkTcTyVarBndr tv
; ty' <- go ty
; return (ForAllTy tv' ty') }
zonkTcTyVarBndr :: TcTyVar -> TcM TcTyVar
-- A tyvar binder is never a unification variable (MetaTv),
-- rather it is always a skolems. BUT it may have a kind
-- that has not yet been zonked, and may include kind
-- unification variables.
zonkTcTyVarBndr tyvar
= ASSERT2( isImmutableTyVar tyvar, ppr tyvar ) do
updateTyVarKindM zonkTcType tyvar
zonkTcTyVar :: TcTyVar -> TcM TcType
-- Simply look through all Flexis
......
......@@ -1478,6 +1478,20 @@ Example
, ev_decomp = \c. [nth 1 c, nth 2 c] })
(\fresh-goals. stuff)
Note [Bind new Givens immediately]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For Givens we make new EvVars and bind them immediately. We don't worry
about caching, but we don't expect complicated calculations among Givens.
It is important to bind each given:
class (a~b) => C a b where ....
f :: C a b => ....
Then in f's Givens we have g:(C a b) and the superclass sc(g,0):a~b.
But that superclass selector can't (yet) appear in a coercion
(see evTermCoercion), so the easy thing is to bind it to an Id.
See Note [Coercion evidence terms] in TcEvidence.
\begin{code}
xCtFlavor :: CtEvidence -- Original flavor
-> [TcPredType] -- New predicate types
......@@ -1494,14 +1508,7 @@ xCtFlavor_cache :: Bool -- True = if wanted add to the solved bag!
xCtFlavor_cache _ (Given { ctev_gloc = gl, ctev_evtm = tm }) ptys xev
= ASSERT( equalLength ptys (ev_decomp xev tm) )
zipWithM (newGivenEvVar gl) ptys (ev_decomp xev tm)
-- For Givens we make new EvVars and bind them immediately. We don't worry
-- about caching, but we don't expect complicated calculations among Givens.
-- It is important to bind each given:
-- class (a~b) => C a b where ....
-- f :: C a b => ....
-- Then in f's Givens we have g:(C a b) and the superclass sc(g,0):a~b.
-- But that superclass selector can't (yet) appear in a coercion
-- (see evTermCoercion), so the easy thing is to bind it to an Id
-- See Note [Bind new Givens immediately]
xCtFlavor_cache cache ctev@(Wanted { ctev_wloc = wl, ctev_evar = evar }) ptys xev
= do { new_evars <- mapM (newWantedEvVar wl) ptys
......@@ -1560,7 +1567,8 @@ rewriteCtFlavor_cache _cache (Derived { ctev_wloc = wl }) pty_new _co
= newDerived wl pty_new
rewriteCtFlavor_cache _cache (Given { ctev_gloc = gl, ctev_evtm = old_tm }) pty_new co
= return (Just (Given { ctev_gloc = gl, ctev_pred = pty_new, ctev_evtm = new_tm }))
= do { new_ev <- newGivenEvVar gl pty_new new_tm -- See Note [Bind new Givens immediately]
; return (Just new_ev) }
where
new_tm = mkEvCast old_tm (mkTcSymCo co) -- mkEvCase optimises ReflCo
......
......@@ -1042,7 +1042,9 @@ tcConArg new_or_data bty
= do { traceTc "tcConArg 1" (ppr bty)
; arg_ty <- tcHsConArgType new_or_data bty
; traceTc "tcConArg 2" (ppr bty)
; strict_mark <- chooseBoxingStrategy arg_ty (getBangStrictness bty)
; dflags <- getDynFlags
; let strict_mark = chooseBoxingStrategy dflags arg_ty (getBangStrictness bty)
-- Must be computed lazily
; return (arg_ty, strict_mark) }
tcConRes :: ResType (LHsType Name) -> TcM (ResType Type)
......@@ -1178,28 +1180,29 @@ conRepresentibleWithH98Syntax
--
-- We have turned off unboxing of newtypes because coercions make unboxing
-- and reboxing more complicated
chooseBoxingStrategy :: TcType -> HsBang -> TcM HsBang
chooseBoxingStrategy arg_ty bang
= case bang of
HsNoBang -> return HsNoBang
HsStrict -> do { unbox_strict <- doptM Opt_UnboxStrictFields
; if unbox_strict then return (can_unbox HsStrict arg_ty)
else return HsStrict }
HsNoUnpack -> return HsStrict
HsUnpack -> do { omit_prags <- doptM Opt_OmitInterfacePragmas
; let bang = can_unbox HsUnpackFailed arg_ty
; if omit_prags && bang == HsUnpack
then return HsStrict
else return bang }
-- Do not respect UNPACK pragmas if OmitInterfacePragmas is on
-- See Trac #5252: unpacking means we must not conceal the
-- representation of the argument type
-- However: even when OmitInterfacePragmas is on, we still want
-- to know if we have HsUnpackFailed, because we omit a
-- warning in that case (#3966)
HsUnpackFailed -> pprPanic "chooseBoxingStrategy" (ppr arg_ty)
-- Source code never has shtes
chooseBoxingStrategy :: DynFlags -> TcType -> HsBang -> HsBang
chooseBoxingStrategy dflags arg_ty bang
= case initial_choice of
HsUnpack | dopt Opt_OmitInterfacePragmas dflags
-> HsStrict
_other -> initial_choice
-- Do not respect UNPACK pragmas if OmitInterfacePragmas is on
-- See Trac #5252: unpacking means we must not conceal the
-- representation of the argument type
-- However: even when OmitInterfacePragmas is on, we still want
-- to know if we have HsUnpackFailed, because we omit a
-- warning in that case (#3966)
where
initial_choice = case bang of
HsNoBang -> HsNoBang
HsStrict | dopt Opt_UnboxStrictFields dflags
-> can_unbox HsStrict arg_ty
| otherwise -> HsStrict
HsNoUnpack -> HsStrict
HsUnpack -> can_unbox HsUnpackFailed arg_ty
HsUnpackFailed -> pprPanic "chooseBoxingStrategy" (ppr arg_ty)
-- Source code never has HsUnpackFailed
can_unbox :: HsBang -> TcType -> HsBang
-- Returns HsUnpack if we can unpack arg_ty
-- fail_bang if we know what arg_ty is but we can't unpack it
......
......@@ -1162,17 +1162,20 @@ uUnboundKVar kv1 k2@(TyVarTy kv2)
uUnboundKVar kv1 non_var_k2
= do { k2' <- zonkTcKind non_var_k2
; kindOccurCheck kv1 k2'
; let k2'' = defaultKind k2'
-- MetaKindVars must be bound only to simple kinds
; kindUnifCheck kv1 k2''
; writeMetaTyVar kv1 k2'' }
----------------
kindOccurCheck :: TyVar -> Type -> TcM ()
kindOccurCheck kv1 k2 -- k2 is zonked
= if elemVarSet kv1 (tyVarsOfType k2)
then failWithTc (kindOccurCheckErr kv1 k2)
else return ()
kindUnifCheck :: TyVar -> Type -> TcM ()
kindUnifCheck kv1 k2 -- k2 is zonked
| elemVarSet kv1 (tyVarsOfType k2)
= failWithTc (kindOccurCheckErr kv1 k2)
| isSigTyVar kv1
= failWithTc (kindSigVarErr kv1 k2)
| otherwise
= return ()
mkKindErrorCtxt :: Type -> Type -> Kind -> Kind -> TidyEnv -> TcM (TidyEnv, SDoc)
mkKindErrorCtxt ty1 ty2 k1 k2 env0
......@@ -1204,4 +1207,9 @@ kindOccurCheckErr :: Var -> Type -> SDoc
kindOccurCheckErr tyvar ty
= hang (ptext (sLit "Occurs check: cannot construct the infinite kind:"))
2 (sep [ppr tyvar, char '=', ppr ty])
kindSigVarErr :: Var -> Type -> SDoc
kindSigVarErr tv ty
= hang (ptext (sLit "Cannot unify the kind variable") <+> quotes (ppr tv))
2 (ptext (sLit "with the kind") <+> quotes (ppr ty))
\end{code}
......@@ -612,14 +612,14 @@ newtype at outermost level; and bale out if we see it again.
Note [Nullary unboxed tuple]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We represent the nullary unboxed tuple as the unary (but void) type State# RealWorld.
The reason for this is that the ReprArity is never less than the Arity (as it would
otherwise be for a function type like (# #) -> Int).
As a result, ReprArity is always strictly positive if Arity is. This is important
because it allows us to distinguish at runtime between a thunk and a function
takes a nullary unboxed tuple as an argument!
We represent the nullary unboxed tuple as the unary (but void) type
State# RealWorld. The reason for this is that the ReprArity is never
less than the Arity (as it would otherwise be for a function type like
(# #) -> Int).
As a result, ReprArity is always strictly positive if Arity is. This
is important because it allows us to distinguish at runtime between a
thunk and a function takes a nullary unboxed tuple as an argument!
\begin{code}
type UnaryType = Type
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment