Skip to content

Instantly share code, notes, and snippets.

@jkarni
Created December 9, 2016 14:31
Show Gist options
  • Save jkarni/828065f3f9fdfce998f91bc91b7b155e to your computer and use it in GitHub Desktop.
Save jkarni/828065f3f9fdfce998f91bc91b7b155e to your computer and use it in GitHub Desktop.
ghc-core for non-let-generalized non-firiing
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 186, types: 1,481, coercions: 3,686}
-- RHS size: {terms: 2, types: 0, coercions: 0}
$s$fShowBook'7 :: [Char]
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 40 0}]
$s$fShowBook'7 = unpackCString# "age"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
$s$fShowBook'5 :: [Char]
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 40 0}]
$s$fShowBook'5 = unpackCString# "name"#
-- RHS size: {terms: 3, types: 1, coercions: 0}
$s$fShowBook'6 :: [Char]
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
$s$fShowBook'6 =
:
@ Char
Bookkeeper.Internal.Types.$fShowHelperBook'1
$s$fShowBook'7
-- RHS size: {terms: 3, types: 1, coercions: 0}
$s$fShowBook'4 :: [Char]
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
$s$fShowBook'4 =
:
@ Char
Bookkeeper.Internal.Types.$fShowHelperBook'1
$s$fShowBook'5
-- RHS size: {terms: 3, types: 2, coercions: 0}
$s$fShowBook'3 :: [Char]
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
$s$fShowBook'3 =
: @ Char shows6 ([] @ Char)
-- RHS size: {terms: 35, types: 191, coercions: 19}
$w$dShowHelper [InlPrag=[0]]
:: Book' Identity '["age" :=> Int, "name" :=> [Char]]
-> (# (String, String), [(String, String)] #)
[GblId,
Arity=1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [20] 220 30}]
$w$dShowHelper =
\ (w_s5lE :: Book' Identity '["age" :=> Int, "name" :=> [Char]]) ->
case w_s5lE
of _ [Occ=Dead]
{ Bookkeeper.Internal.Types.BCons @ a0_a2QZ @ as0_a2R0 @ k10_a2R1
cobox0_a2R2 v1_a2R3 rest_a2R4 ->
case v1_a2R3 `cast` ... of _ [Occ=Dead] { I# ww3_s5mu ->
case rest_a2R4 `cast` ...
of _ [Occ=Dead]
{ Bookkeeper.Internal.Types.BCons @ a1_s5mx @ as1_s5my @ k1_s5mz
cobox1_s5mA v2_s5mB rest1_s5mC ->
(# ($s$fShowBook'6,
++
@ Char
Data.Functor.Identity.$fShowIdentity1
(case $wshowSignedInt 11# ww3_s5mu ([] @ Char)
of _ [Occ=Dead] { (# ww5_a5kG, ww6_a5kH #) ->
: @ Char ww5_a5kG ww6_a5kH
})),
:
@ (String, String)
($s$fShowBook'4,
++
@ Char
Data.Functor.Identity.$fShowIdentity1
(:
@ Char
shows6
(showLitString (v2_s5mB `cast` ...) $s$fShowBook'3)))
([] @ (String, String)) #)
}
}
}
-- RHS size: {terms: 8, types: 44, coercions: 0}
$s$fShowBook'2 [InlPrag=INLINE[0]]
:: Book' Identity '["age" :=> Int, "name" :=> [Char]]
-> [(String, String)]
[GblId,
Arity=1,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
Tmpl= \ (w_s5lE [Occ=Once]
:: Book' Identity '["age" :=> Int, "name" :=> [Char]]) ->
case $w$dShowHelper w_s5lE
of _ [Occ=Dead] { (# ww1_s5lK [Occ=Once], ww2_s5lL [Occ=Once] #) ->
: @ (String, String) ww1_s5lK ww2_s5lL
}}]
$s$fShowBook'2 =
\ (w_s5lE :: Book' Identity '["age" :=> Int, "name" :=> [Char]]) ->
case $w$dShowHelper w_s5lE
of _ [Occ=Dead] { (# ww1_s5lK, ww2_s5lL #) ->
: @ (String, String) ww1_s5lK ww2_s5lL
}
-- RHS size: {terms: 9, types: 88, coercions: 50}
$dSubset_r5nb
:: forall k1_a2RE (f_a2RF :: k1_a2RE -> Type).
Book' f_a2RF '["name" :=> [Char]]
-> Book' f_a2RF '["name" :=> [Char]]
$dSubset_r5nb =
\ (@ k1_a2RE)
(@ (f_a2RF :: k1_a2RE -> Type))
(eta_a2RG :: Book' f_a2RF '["name" :=> [Char]]) ->
case eta_a2RG
of _ [Occ=Dead]
{ Bookkeeper.Internal.Types.BCons @ a0_a2RK @ as0_a2RL @ k20_a2RM
cobox1_a2RN value1_a2RO oldBook_a2RP ->
(Bookkeeper.Internal.Types.BCons
@ k1_a2RE
@ f_a2RF
@ '["name" :=> a0_a2RK]
@ a0_a2RK
@ '[]
@ "name"
@~ ...
value1_a2RO
(oldBook_a2RP `cast` ...))
`cast` ...
}
-- RHS size: {terms: 1, types: 30, coercions: 12}
$d~_r5nc
:: ('["name" :=> [Char]] :: [*]) ~~ ('["name" :=> [Char]] :: [*])
$d~_r5nc =
Eq#
@ [*] @ [*] @ '["name" :=> [Char]] @ '["name" :=> [Char]] @~ ...
-- RHS size: {terms: 3, types: 45, coercions: 50}
$dInsertable'_r5nd
:: forall (f_a2G6 :: * -> *).
Data.Proxy.Proxy 'GT
-> Key "name"
-> f_a2G6 [Char]
-> Book' f_a2G6 '["age" :=> Int, "name" :=> [Char]]
-> Book' f_a2G6 '["age" :=> Int, "name" :=> [Char]]
$dInsertable'_r5nd =
Bookkeeper.Internal.Types.$fInsertable'kOrderingGTkeyvalue::_$cinsert'
@ *
@ *
@ '["name" :=> [Char]]
@ "name"
@ [Char]
@ '["name" :=> [Char]]
@ "age"
@ Int
($d~_r5nc `cast` ...)
((Bookkeeper.Internal.Types.$fInsertablekkeyvalue:0_$cinsert
@ * @ * @ "name" @ [Char] @ [Char] @ '[])
`cast` ...)
-- RHS size: {terms: 2, types: 0, coercions: 0}
$trModule2 :: TrName
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 20}]
$trModule2 = TrNameS "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
$trModule1 :: TrName
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 20}]
$trModule1 = TrNameS "Main"#
-- RHS size: {terms: 3, types: 0, coercions: 0}
$trModule :: Module
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
$trModule = Module $trModule2 $trModule1
-- RHS size: {terms: 2, types: 29, coercions: 26}
$dSubset1_r5ne
:: forall k_a2FE (f_a2FF :: k_a2FE -> Type).
Book' f_a2FF '["age" :=> Int, "name" :=> [Char]]
-> Book' f_a2FF '["name" :=> [Char]]
$dSubset1_r5ne =
Bookkeeper.Internal.Types.$fSubset:subset_$cgetSubset
@ '["name" :=> [Char]]
@ '["name" :=> [Char]]
@ ("age" :=> Int)
($dSubset_r5nb `cast` ...)
-- RHS size: {terms: 2, types: 21, coercions: 171}
$dInsertable_r5nf
:: forall (f_a2Jd :: * -> *).
Key "name"
-> f_a2Jd [Char]
-> Book' f_a2Jd '["age" :=> Int, "name" :=> [Char]]
-> Book'
f_a2Jd
(Bookkeeper.Internal.Types.Insert
"name" [Char] '["age" :=> Int, "name" :=> [Char]])
$dInsertable_r5nf =
Bookkeeper.Internal.Types.$fInsertablekkeyvalue:_$cinsert
@ *
@ *
@ "name"
@ "age"
@ [Char]
@ Int
@ '["name" :=> [Char]]
($dInsertable'_r5nd `cast` ...)
-- RHS size: {terms: 2, types: 0, coercions: 0}
dt_r5ng :: Int
dt_r5ng = I# 0#
-- RHS size: {terms: 1, types: 5, coercions: 2}
dt1_r5nh :: Book' Identity '[]
dt1_r5nh =
Bookkeeper.Internal.Types.BNil @ * @ Identity @ '[] @~ ...
-- RHS size: {terms: 3, types: 20, coercions: 15}
dt2_r5ni :: Book' Identity '["name" :=> [Char]]
dt2_r5ni =
Bookkeeper.Internal.Types.BCons
@ *
@ Identity
@ '["name" :=> [Char]]
@ [Char]
@ '[]
@ "name"
@~ ...
(([] @ Char) `cast` ...)
dt1_r5nh
-- RHS size: {terms: 3, types: 37, coercions: 23}
pb_r5nj :: Book' Identity '["age" :=> Int, "name" :=> [Char]]
pb_r5nj =
Bookkeeper.Internal.Types.BCons
@ *
@ Identity
@ '["age" :=> Int, "name" :=> [Char]]
@ Int
@ '["name" :=> [Char]]
@ "age"
@~ ...
(dt_r5ng `cast` ...)
dt2_r5ni
-- RHS size: {terms: 3, types: 52, coercions: 60}
lvl2_r5nk
:: (Gettable "name" '["age" :=> Int, "name" :=> [Char]] [Char],
Bookkeeper.Internal.Types.Insertable
"name" [Char] '["age" :=> Int, "name" :=> [Char]])
lvl2_r5nk =
($dSubset1_r5ne `cast` ..., $dInsertable_r5nf `cast` ...)
-- RHS size: {terms: 2, types: 0, coercions: 0}
lvl3_r5nl :: Char
lvl3_r5nl = C# 'c'#
-- RHS size: {terms: 2, types: 1, coercions: 0}
lvl4_r5nm :: [Char] -> [Char]
lvl4_r5nm = : @ Char lvl3_r5nl
-- RHS size: {terms: 2, types: 0, coercions: 0}
lvl5_r5nn :: Char
lvl5_r5nn = C# 'a'#
-- RHS size: {terms: 2, types: 1, coercions: 0}
lvl6_r5no :: [Char] -> [Char]
lvl6_r5no = : @ Char lvl5_r5nn
-- RHS size: {terms: 5, types: 26, coercions: 501}
lvl7_r5np
:: Book'
Identity
(Bookkeeper.Internal.Types.Insert
"name"
[Char]
(Bookkeeper.Internal.Types.Sort
'["name" :=> String, "age" :=> Int]))
lvl7_r5np =
modify
@ "name"
@ [Char]
@ [Char]
@ (Bookkeeper.Internal.Types.Sort
'["name" :=> String, "age" :=> Int])
(lvl2_r5nk `cast` ...)
(Bookkeeper.Internal.Types.Key @ "name")
lvl6_r5no
(pb_r5nj `cast` ...)
-- RHS size: {terms: 5, types: 26, coercions: 307}
fusionB1_r5nq
:: Book'
Identity
(Bookkeeper.Internal.Types.Insert
"name" [Char] '["age" :=> Int, "name" :=> [Char]])
fusionB1_r5nq =
modify
@ "name"
@ [Char]
@ [Char]
@ '["age" :=> Int, "name" :=> [Char]]
lvl2_r5nk
(Bookkeeper.Internal.Types.Key @ "name")
lvl4_r5nm
(lvl7_r5np `cast` ...)
-- RHS size: {terms: 1, types: 0, coercions: 309}
fusionB [InlPrag=NOINLINE] :: PersonB
fusionB = fusionB1_r5nq `cast` ...
-- RHS size: {terms: 3, types: 52, coercions: 333}
lvl8_r5nr
:: (Gettable
"name"
(Bookkeeper.Internal.Types.Sort
'["name" :=> String, "age" :=> Int])
[Char],
Bookkeeper.Internal.Types.Insertable
"name"
[Char]
(Bookkeeper.Internal.Types.Sort
'["name" :=> String, "age" :=> Int]))
lvl8_r5nr =
($dSubset1_r5ne `cast` ..., $dInsertable_r5nf `cast` ...)
-- RHS size: {terms: 3, types: 64, coercions: 627}
lvl9_r5ns
:: (Gettable
"name"
(Bookkeeper.Internal.Types.Insert
"name"
[Char]
(Bookkeeper.Internal.Types.Sort
'["name" :=> String, "age" :=> Int]))
[Char],
Bookkeeper.Internal.Types.Insertable
"name"
[Char]
(Bookkeeper.Internal.Types.Insert
"name"
[Char]
(Bookkeeper.Internal.Types.Sort
'["name" :=> String, "age" :=> Int])))
lvl9_r5ns =
($dSubset1_r5ne `cast` ..., $dInsertable_r5nf `cast` ...)
-- RHS size: {terms: 8, types: 41, coercions: 173}
fusionB'1_r5nt
:: Book'
Identity
(Bookkeeper.Internal.Types.Insert
"name"
[Char]
(Bookkeeper.Internal.Types.Insert
"name"
[Char]
(Bookkeeper.Internal.Types.Sort
'["name" :=> String, "age" :=> Int])))
fusionB'1_r5nt =
fusedModify
@ "name"
@ [Char]
@ [Char]
@ (Bookkeeper.Internal.Types.Sort'
'["name" :=> String, "age" :=> Int] '[])
@ [Char]
@ [Char]
lvl8_r5nr
((Eq# @ * @ * @ [Char] @ [Char] @~ ...) `cast` ...)
lvl9_r5ns
(Bookkeeper.Internal.Types.Key @ "name")
lvl4_r5nm
lvl6_r5no
(pb_r5nj `cast` ...)
-- RHS size: {terms: 1, types: 0, coercions: 627}
fusionB' [InlPrag=NOINLINE] :: PersonB
fusionB' = fusionB'1_r5nt `cast` ...
-- RHS size: {terms: 3, types: 20, coercions: 186}
main2 :: String
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 30 0}]
main2 =
Bookkeeper.Internal.Types.$fShowBook'_$cshow
@ '["age" :=> Int, "name" :=> [Char]]
($s$fShowBook'2 `cast` ...)
(fusionB' `cast` ...)
-- RHS size: {terms: 3, types: 20, coercions: 186}
main3 :: String
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 30 0}]
main3 =
Bookkeeper.Internal.Types.$fShowBook'_$cshow
@ '["age" :=> Int, "name" :=> [Char]]
($s$fShowBook'2 `cast` ...)
(fusionB `cast` ...)
-- RHS size: {terms: 13, types: 11, coercions: 0}
main1
:: State# RealWorld
-> (# State# RealWorld, () #)
[GblId,
Arity=1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [0] 90 0}]
main1 =
\ (s_a3gn [OS=OneShot] :: State# RealWorld) ->
case Handle.Text.hPutStr2
Handle.FD.stdout main3 True s_a3gn
of _ [Occ=Dead] { (# ipv_a3gq, ipv1_a3gr #) ->
Handle.Text.hPutStr2
Handle.FD.stdout main2 True ipv_a3gq
}
-- RHS size: {terms: 1, types: 0, coercions: 3}
main :: IO ()
[GblId,
Arity=1,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)
Tmpl= main1 `cast` ...}]
main = main1 `cast` ...
-- RHS size: {terms: 2, types: 1, coercions: 3}
main4
:: State# RealWorld
-> (# State# RealWorld, () #)
[GblId,
Arity=1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 60}]
main4 = runMainIO1 @ () (main1 `cast` ...)
-- RHS size: {terms: 1, types: 0, coercions: 3}
:main :: IO ()
[GblId,
Arity=1,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)
Tmpl= main4 `cast` ...}]
:main = main4 `cast` ...
Linking bookkeeper/bench/Main ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment