Skip to content

Instantly share code, notes, and snippets.

@ndmitchell
Created February 21, 2021 23:12
Show Gist options
  • Save ndmitchell/a45d1db2eea8f8b2ee207e5d29475fce to your computer and use it in GitHub Desktop.
Save ndmitchell/a45d1db2eea8f8b2ee207e5d29475fce to your computer and use it in GitHub Desktop.
[1 of 1] Compiling Main ( Test.hs, Test.o )
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 91, types: 143, coercions: 20, joins: 0/2}
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
Main.$trModule4 :: GHC.Prim.Addr#
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
Main.$trModule4 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
Main.$trModule3 :: GHC.Types.TrName
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
Main.$trModule3 = GHC.Types.TrNameS Main.$trModule4
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
Main.$trModule2 :: GHC.Prim.Addr#
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
Main.$trModule2 = "Main"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
Main.$trModule1 :: GHC.Types.TrName
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
Main.$trModule1 = GHC.Types.TrNameS Main.$trModule2
-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
Main.$trModule :: GHC.Types.Module
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
Main.$trModule = GHC.Types.Module Main.$trModule3 Main.$trModule1
-- RHS size: {terms: 14, types: 7, coercions: 0, joins: 0/2}
lvl_r1hP :: Int -> (Int, Int)
[GblId, Arity=1, Str=<S,1*U(U)>, Cpr=m1, Unf=OtherCon []]
lvl_r1hP
= \ (old_aNs :: Int) ->
case old_aNs of { GHC.Types.I# x_aNL ->
let {
ipv_s1iF :: GHC.Prim.Int#
[LclId]
ipv_s1iF = GHC.Prim.+# x_aNL 1# } in
let {
_new1_s1iE :: Int
[LclId, Unf=OtherCon []]
_new1_s1iE = GHC.Types.I# ipv_s1iF } in
(_new1_s1iE, _new1_s1iE)
}
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
lvl1_r1jU :: Int
[GblId, Unf=OtherCon []]
lvl1_r1jU = GHC.Types.I# 0#
-- RHS size: {terms: 27, types: 64, coercions: 7, joins: 0/0}
resourceId [InlPrag=NOINLINE] :: IO Int
[GblId]
resourceId
= GHC.Magic.runRW#
@'GHC.Types.LiftedRep
@(IO Int)
((\ (s_aLA [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld)
(eta_B0 [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
case GHC.Prim.noDuplicate# @GHC.Prim.RealWorld s_aLA of s'_aLB
{ __DEFAULT ->
case GHC.Prim.newMutVar# @Int @GHC.Prim.RealWorld lvl1_r1jU s'_aLB
of
{ (# ipv_aMj, ipv1_aMk #) ->
case GHC.Prim.atomicModifyMutVar2#
@GHC.Prim.RealWorld @Int @(Int, Int) ipv1_aMk lvl_r1hP eta_B0
of
{ (# ipv2_aNz, ipv3_aNA, ipv4_aNB #) ->
case ipv4_aNB of { (_new_aNE, _res_aNF) ->
case _res_aNF of res_aNH { GHC.Types.I# ipv5_sNY ->
(# ipv2_aNz, res_aNH #)
}
}
}
}
})
`cast` (<GHC.Prim.State# GHC.Prim.RealWorld>_R
%<'Many>_N ->_R Sym (GHC.Types.N:IO[0] <Int>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, Int #))
~R# (GHC.Prim.State# GHC.Prim.RealWorld -> IO Int)))
-- RHS size: {terms: 23, types: 35, coercions: 4, joins: 0/0}
Main.main1
:: GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId,
Arity=1,
Str=<L,U>,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [0] 170 0}]
Main.main1
= \ (s_aO5 :: GHC.Prim.State# GHC.Prim.RealWorld) ->
case (resourceId
`cast` (GHC.Types.N:IO[0] <Int>_R
:: IO Int
~R# (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, Int #))))
s_aO5
of
{ (# ipv_aMc, ipv1_aMd #) ->
case GHC.IO.Handle.Text.hPutStr2
GHC.IO.StdHandles.stdout
(GHC.Show.$fShowInt_$cshow ipv1_aMd)
GHC.Types.True
ipv_aMc
of
{ (# ipv2_aO7, ipv3_aO8 #) ->
case (resourceId
`cast` (GHC.Types.N:IO[0] <Int>_R
:: IO Int
~R# (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, Int #))))
ipv2_aO7
of
{ (# ipv4_X1F, ipv5_X1G #) ->
GHC.IO.Handle.Text.hPutStr2
GHC.IO.StdHandles.stdout
(GHC.Show.$fShowInt_$cshow ipv5_X1G)
GHC.Types.True
ipv4_X1F
}
}
}
-- RHS size: {terms: 1, types: 0, coercions: 3, joins: 0/0}
main :: IO ()
[GblId,
Arity=1,
Str=<L,U>,
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= Main.main1
`cast` (Sym (GHC.Types.N:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ())}]
main
= Main.main1
`cast` (Sym (GHC.Types.N:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ())
-- RHS size: {terms: 2, types: 1, coercions: 3, joins: 0/0}
Main.main2
:: GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId,
Arity=1,
Str=<L,U>,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=False)
Tmpl= \ (eta_B0 [Occ=Once1, OS=OneShot]
:: GHC.Prim.State# GHC.Prim.RealWorld) ->
GHC.TopHandler.runMainIO1
@()
(Main.main1
`cast` (Sym (GHC.Types.N:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ()))
eta_B0}]
Main.main2
= GHC.TopHandler.runMainIO1
@()
(Main.main1
`cast` (Sym (GHC.Types.N:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ()))
-- RHS size: {terms: 1, types: 0, coercions: 3, joins: 0/0}
:Main.main :: IO ()
[GblId,
Arity=1,
Str=<L,U>,
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= Main.main2
`cast` (Sym (GHC.Types.N:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ())}]
:Main.main
= Main.main2
`cast` (Sym (GHC.Types.N:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ())
Linking Test.exe ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment