Commit c1dacb8a authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari

Produce KindReps for common kinds in GHC.Types

Unfortunately this comes with a fair bit of implementation cost. Perhaps
some refactoring would help, but in the interest of getting 8.2 out the
door I'm pushing as-is.

While this doesn't have nearly the effect on compiler allocations
that D3166 has, it's still nothing to sneeze at. nofib shows,
```
------------------------------------------------------------------------
        Program               master           D3166            D3219
------------------------------------------------------------------------
        -1 s.d.                -----          -3.555%          -4.081%
        +1 s.d.                -----          +1.937%          +1.593%
        Average                -----          -0.847%          -1.285%
```

Test Plan: Validate

Reviewers: austin

Subscribers: thomie, simonmar

Differential Revision: https://phabricator.haskell.org/D3219
parent a694cee7
......@@ -244,6 +244,11 @@ basicKnownKeyNames
typeSymbolTypeRepName, typeNatTypeRepName,
trGhcPrimModuleName,
-- KindReps for common cases
starKindRepName,
starArrStarKindRepName,
starArrStarArrStarKindRepName,
-- Dynamic
toDynName,
......@@ -1268,6 +1273,12 @@ typeSymbolTypeRepName = varQual tYPEABLE_INTERNAL (fsLit "typeSymbolTypeRep") ty
-- See Note [Grand plan for Typeable] in TcTypeable.
trGhcPrimModuleName = varQual gHC_TYPES (fsLit "tr$ModuleGHCPrim") trGhcPrimModuleKey
-- Typeable KindReps for some common cases
starKindRepName, starArrStarKindRepName, starArrStarArrStarKindRepName :: Name
starKindRepName = varQual gHC_TYPES (fsLit "krep$*") starKindRepKey
starArrStarKindRepName = varQual gHC_TYPES (fsLit "krep$*Arr*") starArrStarKindRepKey
starArrStarArrStarKindRepName = varQual gHC_TYPES (fsLit "krep$*->*->*") starArrStarArrStarKindRepKey
-- Custom type errors
errorMessageTypeErrorFamName
, typeErrorTextDataConName
......@@ -2326,6 +2337,12 @@ trTYPE'PtrRepLiftedKey = mkPreludeMiscIdUnique 511
trRuntimeRepKey = mkPreludeMiscIdUnique 512
tr'PtrRepLiftedKey = mkPreludeMiscIdUnique 513
-- KindReps for common cases
starKindRepKey, starArrStarKindRepKey, starArrStarArrStarKindRepKey :: Unique
starKindRepKey = mkPreludeMiscIdUnique 520
starArrStarKindRepKey = mkPreludeMiscIdUnique 521
starArrStarArrStarKindRepKey = mkPreludeMiscIdUnique 522
-- Dynamic
toDynIdKey :: Unique
toDynIdKey = mkPreludeMiscIdUnique 550
......@@ -2350,14 +2367,14 @@ emptyCallStackKey = mkPreludeMiscIdUnique 558
pushCallStackKey = mkPreludeMiscIdUnique 559
fromStaticPtrClassOpKey :: Unique
fromStaticPtrClassOpKey = mkPreludeMiscIdUnique 519
fromStaticPtrClassOpKey = mkPreludeMiscIdUnique 560
makeStaticKey :: Unique
makeStaticKey = mkPreludeMiscIdUnique 520
makeStaticKey = mkPreludeMiscIdUnique 561
-- Natural
naturalFromIntegerIdKey :: Unique
naturalFromIntegerIdKey = mkPreludeMiscIdUnique 521
naturalFromIntegerIdKey = mkPreludeMiscIdUnique 562
{-
************************************************************************
......
......@@ -28,7 +28,7 @@ import Type
import Kind ( isTYPEApp )
import TyCon
import DataCon
import Name ( getOccName )
import Name ( Name, getOccName )
import OccName
import Module
import HsSyn
......@@ -121,7 +121,11 @@ There are many wrinkles:
there is generally little benefit to inlining KindReps and they would
otherwise strongly affect compiler performance.
* Even KindReps aren't inlined this scheme still has more of an effect on
* In general there are lots of things of kind *, * -> *, and * -> * -> *. To
reduce the number of bindings we need to produce, we generate their KindReps
once in GHC.Types. These are referred to as "built-in" KindReps below.
* Even though KindReps aren't inlined this scheme still has more of an effect on
compilation time than I'd like. This is especially true in the case of
families of type constructors (e.g. tuples and unboxed sums). The problem is
particularly bad in the case of sums, since each arity-N tycon brings with it
......@@ -222,12 +226,14 @@ data TypeRepTodo
, todo_tycons :: [TypeableTyCon]
-- ^ The 'TyCon's in need of bindings and their zonked kinds
}
| ExportedKindRepsTodo [(Kind, Id)]
-- ^ Build exported 'KindRep' bindings for the given set of kinds.
todoForTyCons :: Module -> Id -> [TyCon] -> TcM TypeRepTodo
todoForTyCons mod mod_id tycons = do
trTyConTyCon <- tcLookupTyCon trTyConTyConName
trTyConTy <- mkTyConTy <$> tcLookupTyCon trTyConTyConName
let mkRepId :: TyConRepName -> Id
mkRepId rep_name = mkExportedVanillaId rep_name (mkTyConTy trTyConTyCon)
mkRepId rep_name = mkExportedVanillaId rep_name trTyConTy
tycons <- sequence
[ do kind <- zonkTcType $ tyConKind tc''
......@@ -259,25 +265,38 @@ todoForTyCons mod mod_id tycons = do
mod_fpr = fingerprintString $ moduleNameString $ moduleName mod
pkg_fpr = fingerprintString $ unitIdString $ moduleUnitId mod
todoForExportedKindReps :: [(Kind, Name)] -> TcM TypeRepTodo
todoForExportedKindReps kinds = do
trKindRepTy <- mkTyConTy <$> tcLookupTyCon kindRepTyConName
let mkId (k, name) = (k, mkExportedVanillaId name trKindRepTy)
return $ ExportedKindRepsTodo $ map mkId kinds
-- | Generate TyCon bindings for a set of type constructors
mkTypeRepTodoBinds :: [TypeRepTodo] -> TcM TcGblEnv
mkTypeRepTodoBinds [] = getGblEnv
mkTypeRepTodoBinds todos
= do { stuff <- collect_stuff
-- First extend the type environment with all of the bindings which we
-- are going to produce since we may need to refer to them while
-- generating the kind representations of other types.
; let tycon_rep_bndrs :: [Id]
tycon_rep_bndrs = [ tycon_rep_id
| todo <- todos
, TypeableTyCon {..} <- todo_tycons todo
]
; gbl_env <- tcExtendGlobalValEnv tycon_rep_bndrs getGblEnv
-- First extend the type environment with all of the bindings
-- which we are going to produce since we may need to refer to them
-- while generating the kind representations of other types.
; let produced_bndrs :: [Id]
produced_bndrs = [ tycon_rep_id
| todo@(TypeRepTodo{}) <- todos
, TypeableTyCon {..} <- todo_tycons todo
] ++
[ rep_id
| ExportedKindRepsTodo kinds <- todos
, (_, rep_id) <- kinds
]
; gbl_env <- tcExtendGlobalValEnv produced_bndrs getGblEnv
; let mk_binds :: TypeRepTodo -> KindRepM [LHsBinds Id]
mk_binds todo = mapM (mkTyConRepBinds stuff todo)
(todo_tycons todo)
mk_binds todo@(TypeRepTodo {}) =
mapM (mkTyConRepBinds stuff todo) (todo_tycons todo)
mk_binds (ExportedKindRepsTodo kinds) =
mkExportedKindReps stuff kinds >> return []
; (gbl_env, binds) <- setGblEnv gbl_env
$ runKindRepM (mapM mk_binds todos)
; return $ gbl_env `addTypecheckedBinds` concat binds }
......@@ -291,7 +310,8 @@ mkPrimTypeableTodos :: TcM (TcGblEnv, [TypeRepTodo])
mkPrimTypeableTodos
= do { mod <- getModule
; if mod == gHC_TYPES
then do { trModuleTyCon <- tcLookupTyCon trModuleTyConName
then do { -- Build Module binding for GHC.Prim
trModuleTyCon <- tcLookupTyCon trModuleTyConName
; let ghc_prim_module_id =
mkExportedVanillaId trGhcPrimModuleName
(mkTyConTy trModuleTyCon)
......@@ -299,18 +319,22 @@ mkPrimTypeableTodos
; ghc_prim_module_bind <- mkVarBind ghc_prim_module_id
<$> mkModIdRHS gHC_PRIM
-- Extend our environment with above
; gbl_env <- tcExtendGlobalValEnv [ghc_prim_module_id]
getGblEnv
; let gbl_env' = gbl_env `addTypecheckedBinds`
[unitBag ghc_prim_module_bind]
; todo <- todoForTyCons gHC_PRIM ghc_prim_module_id
ghcPrimTypeableTyCons
; return (gbl_env', [todo])
-- Build TypeRepTodos for built-in KindReps
; todo1 <- todoForExportedKindReps builtInKindReps
-- Build TypeRepTodos for types in GHC.Prim
; todo2 <- todoForTyCons gHC_PRIM ghc_prim_module_id
ghcPrimTypeableTyCons
; return ( gbl_env' , [todo1, todo2])
}
else do gbl_env <- getGblEnv
return (gbl_env, [])
}
where
-- | This is the list of primitive 'TyCon's for which we must generate bindings
-- in "GHC.Types". This should include all types defined in "GHC.Prim".
......@@ -419,9 +443,11 @@ typeIsTypeable (LitTy _) = True
typeIsTypeable (CastTy{}) = False
typeIsTypeable (CoercionTy{}) = panic "typeIsTypeable(Coercion)"
-- | Maps kinds to 'KindRep' bindings (or rather, a pair of the bound identifier
-- and its RHS).
type KindRepEnv = TypeMap (Id, LHsExpr Id)
-- | Maps kinds to 'KindRep' bindings. This binding may either be defined in
-- some other module (in which case the @Maybe (LHsExpr Id@ will be 'Nothing')
-- or a binding which we generated in the current module (in which case it will
-- be 'Just' the RHS of the binding).
type KindRepEnv = TypeMap (Id, Maybe (LHsExpr Id))
-- | A monad within which we will generate 'KindRep's. Here we keep an
-- environments containing 'KindRep's which we've already generated so we can
......@@ -432,23 +458,64 @@ newtype KindRepM a = KindRepM { unKindRepM :: StateT KindRepEnv TcRn a }
liftTc :: TcRn a -> KindRepM a
liftTc = KindRepM . lift
-- | We generate @KindRep@s for a few common kinds in @GHC.Types@ so that they
-- can be reused across modules.
builtInKindReps :: [(Kind, Name)]
builtInKindReps =
[ (star, starKindRepName)
, (mkFunTy star star, starArrStarKindRepName)
, (mkFunTys [star, star] star, starArrStarArrStarKindRepName)
]
where
star = liftedTypeKind
initialKindRepEnv :: TcRn KindRepEnv
initialKindRepEnv = foldlM add_kind_rep emptyTypeMap builtInKindReps
where
add_kind_rep acc (k,n) = do
id <- tcLookupId n
return $! extendTypeMap acc k (id, Nothing)
-- | Performed while compiling "GHC.Types" to generate the built-in 'KindRep's.
mkExportedKindReps :: TypeableStuff
-> [(Kind, Id)] -- ^ the kinds to generate bindings for
-> KindRepM ()
mkExportedKindReps stuff@(Stuff {..}) = mapM_ kindrep_binding
where
empty_scope = mkDeBruijnContext []
kindrep_binding :: (Kind, Id) -> KindRepM ()
kindrep_binding (kind, rep_bndr) = do
-- We build the binding manually here instead of using mkKindRepRhs
-- since the latter would find the built-in 'KindRep's in the
-- 'KindRepEnv' (by virtue of being in 'initialKindRepEnv').
rhs <- mkKindRepRhs stuff empty_scope kind
addKindRepBind empty_scope kind rep_bndr rhs
addKindRepBind :: CmEnv -> Kind -> Id -> LHsExpr Id -> KindRepM ()
addKindRepBind in_scope k bndr rhs =
KindRepM $ modify' $
\env -> extendTypeMapWithScope env in_scope k (bndr, Just rhs)
-- | Run a 'KindRepM' and add the produced 'KindRep's to the typechecking
-- environment.
runKindRepM :: KindRepM a -> TcRn (TcGblEnv, a)
runKindRepM (KindRepM action) = do
(res, reps_env) <- runStateT action emptyTypeMap
let reps = foldTypeMap (:) [] reps_env
tcg_env <- tcExtendGlobalValEnv (map fst reps) getGblEnv
let to_bind :: (Id, LHsExpr Id) -> LHsBind Id
to_bind = uncurry mkVarBind
tcg_env' = tcg_env `addTypecheckedBinds` map (unitBag . to_bind) reps
kindRepEnv <- initialKindRepEnv
(res, reps_env) <- runStateT action kindRepEnv
let rep_binds = foldTypeMap to_bind_pair [] reps_env
to_bind_pair (bndr, Just rhs) rest = (bndr, rhs) : rest
to_bind_pair (_, Nothing) rest = rest
tcg_env <- tcExtendGlobalValEnv (map fst rep_binds) getGblEnv
let binds = map (uncurry mkVarBind) rep_binds
tcg_env' = tcg_env `addTypecheckedBinds` [listToBag binds]
return (tcg_env', res)
-- | Produce or find a 'KindRep' for the given kind.
getKindRep :: TypeableStuff -> CmEnv -- ^ in-scope kind variables
-> Kind -- ^ the kind we want a 'KindRep' for
-> KindRepM (LHsExpr Id)
getKindRep (Stuff {..}) in_scope = go
getKindRep stuff@(Stuff {..}) in_scope = go
where
go :: Kind -> KindRepM (LHsExpr Id)
go = KindRepM . StateT . go'
......@@ -470,13 +537,19 @@ getKindRep (Stuff {..}) in_scope = go
<$> newSysLocalId (fsLit "$krep") (mkTyConTy kindRepTyCon)
-- do we need to tie a knot here?
(rhs, env') <- runStateT (unKindRepM $ new_kind_rep k) env
let env'' = extendTypeMapWithScope env' in_scope k (rep_bndr, rhs)
return (nlHsVar rep_bndr, env'')
new_kind_rep :: Kind -- ^ the kind we want a 'KindRep' for
-> KindRepM (LHsExpr Id)
flip runStateT env $ unKindRepM $ do
rhs <- mkKindRepRhs stuff in_scope k
addKindRepBind in_scope k rep_bndr rhs
return $ nlHsVar rep_bndr
-- | Construct the right-hand-side of the 'KindRep' for the given 'Kind' and
-- in-scope kind variable set.
mkKindRepRhs :: TypeableStuff
-> CmEnv -- ^ in-scope kind variables
-> Kind -- ^ the kind we want a 'KindRep' for
-> KindRepM (LHsExpr Id) -- ^ RHS expression
mkKindRepRhs stuff@(Stuff {..}) in_scope = new_kind_rep
where
new_kind_rep k
-- We handle TYPE separately to make it clear to consumers
-- (e.g. serializers) that there is a loop here (as
......@@ -492,15 +565,15 @@ getKindRep (Stuff {..}) in_scope = go
= pprPanic "mkTyConKindRepBinds.go(tyvar)" (ppr v)
new_kind_rep (AppTy t1 t2)
= do rep1 <- go t1
rep2 <- go t2
= do rep1 <- getKindRep stuff in_scope t1
rep2 <- getKindRep stuff in_scope t2
return $ nlHsDataCon kindRepAppDataCon
`nlHsApp` rep1 `nlHsApp` rep2
new_kind_rep k@(TyConApp tc tys)
| Just rep_name <- tyConRepName_maybe tc
= do rep_id <- liftTc $ lookupId rep_name
tys' <- mapM go tys
tys' <- mapM (getKindRep stuff in_scope) tys
return $ nlHsDataCon kindRepTyConAppDataCon
`nlHsApp` nlHsVar rep_id
`nlHsApp` mkList (mkTyConTy kindRepTyCon) tys'
......@@ -511,8 +584,8 @@ getKindRep (Stuff {..}) in_scope = go
= pprPanic "mkTyConKindRepBinds(ForAllTy)" (ppr var $$ ppr ty)
new_kind_rep (FunTy t1 t2)
= do rep1 <- go t1
rep2 <- go t2
= do rep1 <- getKindRep stuff in_scope t1
rep2 <- getKindRep stuff in_scope t2
return $ nlHsDataCon kindRepFunDataCon
`nlHsApp` rep1 `nlHsApp` rep2
......
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 74, types: 46, coercions: 1, joins: 0/0}
= {terms: 63, types: 43, coercions: 1, joins: 0/0}
-- RHS size: {terms: 2, types: 4, coercions: 1, joins: 0/0}
T2431.$WRefl [InlPrag=INLINE[2]] :: forall a. a :~: a
......@@ -50,22 +50,7 @@ T2431.$trModule = GHC.Types.Module $trModule2 $trModule4
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
$krep :: GHC.Types.KindRep
[GblId, Caf=NoCafRefs]
$krep = GHC.Types.KindRepTYPE GHC.Types.LiftedRep
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
$krep1 :: GHC.Types.KindRep
[GblId, Caf=NoCafRefs]
$krep1 = GHC.Types.KindRepFun $krep $krep
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
$krep2 :: GHC.Types.KindRep
[GblId, Caf=NoCafRefs]
$krep2 = GHC.Types.KindRepFun $krep $krep1
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
$krep3 :: GHC.Types.KindRep
[GblId, Caf=NoCafRefs]
$krep3 = GHC.Types.KindRepVar 0#
$krep = GHC.Types.KindRepVar 0#
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$tc:~:1 :: GHC.Prim.Addr#
......@@ -79,7 +64,7 @@ $tc:~:2 = GHC.Types.TrNameS $tc:~:1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
T2431.$tc:~: :: GHC.Types.TyCon
[GblId, Caf=NoCafRefs]
[GblId]
T2431.$tc:~:
= GHC.Types.TyCon
4608886815921030019##
......@@ -87,24 +72,24 @@ T2431.$tc:~:
T2431.$trModule
$tc:~:2
0#
$krep2
GHC.Types.krep$*->*->*
-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
$krep4 :: [GHC.Types.KindRep]
$krep1 :: [GHC.Types.KindRep]
[GblId, Caf=NoCafRefs]
$krep4
$krep1
= GHC.Types.:
@ GHC.Types.KindRep $krep3 (GHC.Types.[] @ GHC.Types.KindRep)
@ GHC.Types.KindRep $krep (GHC.Types.[] @ GHC.Types.KindRep)
-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0}
$krep5 :: [GHC.Types.KindRep]
$krep2 :: [GHC.Types.KindRep]
[GblId, Caf=NoCafRefs]
$krep5 = GHC.Types.: @ GHC.Types.KindRep $krep3 $krep4
$krep2 = GHC.Types.: @ GHC.Types.KindRep $krep $krep1
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
$krep6 :: GHC.Types.KindRep
[GblId, Caf=NoCafRefs]
$krep6 = GHC.Types.KindRepTyConApp T2431.$tc:~: $krep5
$krep3 :: GHC.Types.KindRep
[GblId]
$krep3 = GHC.Types.KindRepTyConApp T2431.$tc:~: $krep2
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$tc'Refl1 :: GHC.Prim.Addr#
......@@ -118,7 +103,7 @@ $tc'Refl2 = GHC.Types.TrNameS $tc'Refl1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
T2431.$tc'Refl :: GHC.Types.TyCon
[GblId, Caf=NoCafRefs]
[GblId]
T2431.$tc'Refl
= GHC.Types.TyCon
2478588351447975921##
......@@ -126,7 +111,7 @@ T2431.$tc'Refl
T2431.$trModule
$tc'Refl2
1#
$krep6
$krep3
......@@ -50,7 +50,7 @@
(0))))))
({ <no location info> }
(HsVar
({ <no location info> }{Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})})))))
({ <no location info> }{Var: (ghc-prim:GHC.Types.krep$*{v} [gid] :: ghc-prim:GHC.Types.KindRep{tc})})))))
(False))),
({ <no location info> }
(VarBind {Var: (main:DumpTypecheckedAst.$tc'Zero{v} [lidx] :: ghc-prim:GHC.Types.TyCon{tc})}
......@@ -168,17 +168,6 @@
(HsVar
({ <no location info> }{Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})})))))
(False))),
({ <no location info> }
(VarBind {Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})}
({ <no location info> }
(HsApp
({ <no location info> }
(HsConLikeOut
({abstract:ConLike})))
({ <no location info> }
(HsConLikeOut
({abstract:ConLike})))))
(False))),
({ <no location info> }
(VarBind {Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})}
({ <no location info> }
......
......@@ -64,7 +64,7 @@ Roles1.$tcT5
Roles1.$trModule
(GHC.Types.TrNameS "T5"#)
0
$krep
GHC.Types.krep$*Arr*
Roles1.$tc'K5
= GHC.Types.TyCon
5548842497263642061##
......@@ -112,7 +112,7 @@ Roles1.$tcT2
Roles1.$trModule
(GHC.Types.TrNameS "T2"#)
0
$krep
GHC.Types.krep$*Arr*
Roles1.$tc'K2
= GHC.Types.TyCon
11054915488163123841##
......@@ -128,7 +128,7 @@ Roles1.$tcT1
Roles1.$trModule
(GHC.Types.TrNameS "T1"#)
0
$krep
GHC.Types.krep$*Arr*
Roles1.$tc'K1
= GHC.Types.TyCon
1265606750138351672##
......@@ -143,15 +143,16 @@ $krep [InlPrag=[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 1
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 2
$krep [InlPrag=[~]] = GHC.Types.KindRepApp $krep $krep
$krep [InlPrag=[~]]
= GHC.Types.KindRepFun $krep GHC.Types.krep$*Arr*
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep GHC.Types.krep$*
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]]
= GHC.Types.KindRepFun GHC.Types.krep$*Arr* GHC.Types.krep$*Arr*
$krep [InlPrag=[~]]
= GHC.Types.KindRepTyConApp
Roles1.$tcT7 ((:) $krep ((:) $krep ((:) $krep [])))
......@@ -161,7 +162,6 @@ $krep [InlPrag=[~]]
= GHC.Types.KindRepTyConApp Roles1.$tcT4 ((:) $krep ((:) $krep []))
$krep [InlPrag=[~]]
= GHC.Types.KindRepTyConApp Roles1.$tcT3 ((:) $krep ((:) $krep []))
$krep [InlPrag=[~]] = GHC.Types.KindRepTYPE GHC.Types.LiftedRep
$krep [InlPrag=[~]]
= GHC.Types.KindRepTyConApp Roles1.$tcT5 ((:) $krep [])
$krep [InlPrag=[~]]
......
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 105, types: 40, coercions: 5, joins: 0/0}
= {terms: 98, types: 38, coercions: 5, joins: 0/0}
-- RHS size: {terms: 2, types: 2, coercions: 0, joins: 0/0}
convert1 :: Wrap Age -> Wrap Age
......@@ -51,17 +51,7 @@ $krep
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
$krep1 :: GHC.Types.KindRep
[GblId, Caf=NoCafRefs]
$krep1 = GHC.Types.KindRepTYPE GHC.Types.LiftedRep
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
$krep2 :: GHC.Types.KindRep
[GblId, Caf=NoCafRefs]
$krep2 = GHC.Types.KindRepFun $krep1 $krep1
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
$krep3 :: GHC.Types.KindRep
[GblId, Caf=NoCafRefs]
$krep3 = GHC.Types.KindRepVar 0#
$krep1 = GHC.Types.KindRepVar 0#
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$tcAge1 :: GHC.Prim.Addr#
......@@ -75,7 +65,7 @@ $tcAge2 = GHC.Types.TrNameS $tcAge1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
Roles13.$tcAge :: GHC.Types.TyCon
[GblId, Caf=NoCafRefs]
[GblId]
Roles13.$tcAge
= GHC.Types.TyCon
3456257068627873222##
......@@ -83,19 +73,19 @@ Roles13.$tcAge
Roles13.$trModule
$tcAge2
0#
$krep1
GHC.Types.krep$*
-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0}
$krep4 :: GHC.Types.KindRep
[GblId, Caf=NoCafRefs]
$krep4
$krep2 :: GHC.Types.KindRep
[GblId]
$krep2
= GHC.Types.KindRepTyConApp
Roles13.$tcAge (GHC.Types.[] @ GHC.Types.KindRep)
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
$krep5 :: GHC.Types.KindRep
$krep3 :: GHC.Types.KindRep
[GblId]
$krep5 = GHC.Types.KindRepFun $krep $krep4
$krep3 = GHC.Types.KindRepFun $krep $krep2
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$tc'MkAge1 :: GHC.Prim.Addr#
......@@ -117,7 +107,7 @@ Roles13.$tc'MkAge
Roles13.$trModule
$tc'MkAge2
0#
$krep5
$krep3
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$tcWrap1 :: GHC.Prim.Addr#
......@@ -131,7 +121,7 @@ $tcWrap2 = GHC.Types.TrNameS $tcWrap1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
Roles13.$tcWrap :: GHC.Types.TyCon
[GblId, Caf=NoCafRefs]
[GblId]
Roles13.$tcWrap
= GHC.Types.TyCon
13773534096961634492##
......@@ -139,24 +129,24 @@ Roles13.$tcWrap
Roles13.$trModule
$tcWrap2
0#
$krep2
GHC.Types.krep$*Arr*
-- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
$krep6 :: [GHC.Types.KindRep]
$krep4 :: [GHC.Types.KindRep]
[GblId, Caf=NoCafRefs]
$krep6
$krep4
= GHC.Types.:
@ GHC.Types.KindRep $krep3 (GHC.Types.[] @ GHC.Types.KindRep)
@ GHC.Types.KindRep $krep1 (GHC.Types.[] @ GHC.Types.KindRep)
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
$krep7 :: GHC.Types.KindRep
[GblId, Caf=NoCafRefs]
$krep7 = GHC.Types.KindRepTyConApp Roles13.$tcWrap $krep6
$krep5 :: GHC.Types.KindRep
[GblId]
$krep5 = GHC.Types.KindRepTyConApp Roles13.$tcWrap $krep4
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
$krep8 :: GHC.Types.KindRep
[GblId, Caf=NoCafRefs]
$krep8 = GHC.Types.KindRepFun $krep3 $krep7
$krep6 :: GHC.Types.KindRep
[GblId]
$krep6 = GHC.Types.KindRepFun $krep1 $krep5
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$tc'MkWrap1 :: GHC.Prim.Addr#
......@@ -170,7 +160,7 @@ $tc'MkWrap2 = GHC.Types.TrNameS $tc'MkWrap1
-- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0}
Roles13.$tc'MkWrap :: GHC.Types.TyCon
[GblId, Caf=NoCafRefs]
[GblId]
Roles13.$tc'MkWrap
= GHC.Types.TyCon
15580677875333883466##
......@@ -178,7 +168,7 @@ Roles13.$tc'MkWrap
Roles13.$trModule
$tc'MkWrap2
1#
$krep8
$krep6
......@@ -19,7 +19,7 @@ Roles12.$tcC2
Roles12.$trModule
(GHC.Types.TrNameS "C2"#)
0
$krep
GHC.Types.krep$*Arr*
Roles12.$tc'C:C2
= GHC.Types.TyCon
7087988437584478859##
......@@ -31,8 +31,6 @@ Roles12.$tc'C:C2
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepTYPE GHC.Types.LiftedRep
$krep [InlPrag=[~]]
= GHC.Types.KindRepTyConApp Roles12.$tcC2 ((:) $krep [])
Roles12.$trModule
......
......@@ -18,7 +18,7 @@ Roles2.$tcT2
Roles2.$trModule
(GHC.Types.TrNameS "T2"#)
0
$krep
GHC.Types.krep$*Arr*
Roles2.$tc'K2