Skip to content

Instantly share code, notes, and snippets.

@patrickmn
Last active June 13, 2016 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickmn/9a92ab2a088018b2c0631f3bcfd60ebe to your computer and use it in GitHub Desktop.
Save patrickmn/9a92ab2a088018b2c0631f3bcfd60ebe to your computer and use it in GitHub Desktop.
After compiling with ghc -O2 -fforce-recomp -ddump-to-file -ddump-simpl -dsuppress-all cycle.hs
==================== Tidy Core ====================
2016-06-13 18:57:32.911884 UTC
Result size of Tidy Core = {terms: 53, types: 46, coercions: 9}
-- RHS size: {terms: 2, types: 0, coercions: 0}
lvl_r4Cf
lvl_r4Cf = I# -1#
-- RHS size: {terms: 3, types: 2, coercions: 0}
lvl1_r4Cg
lvl1_r4Cg = : lvl_r4Cf []
-- RHS size: {terms: 2, types: 0, coercions: 0}
lvl2_r4Ch
lvl2_r4Ch = I# 1#
-- RHS size: {terms: 3, types: 1, coercions: 0}
lvl3_r4Ci
lvl3_r4Ci = : lvl2_r4Ch lvl1_r4Cg
Rec {
-- RHS size: {terms: 3, types: 1, coercions: 0}
xs'_r4Cj
xs'_r4Cj = ++ lvl3_r4Ci xs'_r4Cj
end Rec }
-- RHS size: {terms: 1, types: 0, coercions: 0}
f
f = xs'_r4Cj
-- RHS size: {terms: 3, types: 1, coercions: 0}
main3
main3 = $wunsafeTake 5# f
-- RHS size: {terms: 4, types: 2, coercions: 0}
main2
main2 = showList__ shows_$sshows11 main3 []
-- RHS size: {terms: 6, types: 2, coercions: 0}
main1
main1 = \ eta_a2ax -> hPutStr2 stdout main2 True eta_a2ax
-- RHS size: {terms: 1, types: 0, coercions: 3}
main
main = main1 `cast` ...
-- RHS size: {terms: 2, types: 1, coercions: 3}
main4
main4 = runMainIO1 (main1 `cast` ...)
-- RHS size: {terms: 1, types: 0, coercions: 3}
main
main = main4 `cast` ...
-- RHS size: {terms: 2, types: 0, coercions: 0}
$trModule2
$trModule2 = TrNameS "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
$trModule1
$trModule1 = TrNameS "Main"#
-- RHS size: {terms: 3, types: 0, coercions: 0}
$trModule
$trModule = Module $trModule2 $trModule1
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE Safe #-}
module Main where
import Prelude hiding (cycle)
import GHC.OldList (cycle)
main = print $ take 5 f
f = cycle [1 :: Int,-1]
{-# NOINLINE f #-}
3c3
< 2016-06-13 18:57:32.911884 UTC
---
> 2016-06-13 18:57:30.212799 UTC
8,9c8,9
< lvl_r4Cf
< lvl_r4Cf = I# -1#
---
> lvl_r4Ci
> lvl_r4Ci = I# -1#
12,13c12,13
< lvl1_r4Cg
< lvl1_r4Cg = : lvl_r4Cf []
---
> lvl1_r4Cj
> lvl1_r4Cj = : lvl_r4Ci []
16,17c16,17
< lvl2_r4Ch
< lvl2_r4Ch = I# 1#
---
> lvl2_r4Ck
> lvl2_r4Ck = I# 1#
20,21c20,21
< lvl3_r4Ci
< lvl3_r4Ci = : lvl2_r4Ch lvl1_r4Cg
---
> lvl3_r4Cl
> lvl3_r4Cl = : lvl2_r4Ck lvl1_r4Cj
25,26c25,26
< xs'_r4Cj
< xs'_r4Cj = ++ lvl3_r4Ci xs'_r4Cj
---
> xs_r4Cm
> xs_r4Cm = ++ lvl3_r4Cl xs_r4Cm
31c31
< f = xs'_r4Cj
---
> f = xs_r4Cm
43c43
< main1 = \ eta_a2ax -> hPutStr2 stdout main2 True eta_a2ax
---
> main1 = \ eta_a2aB -> hPutStr2 stdout main2 True eta_a2aB
After compiling with ghc -O2 -fforce-recomp -ddump-to-file -ddump-simpl -dsuppress-all repeat.hs
==================== Tidy Core ====================
2016-06-13 18:57:30.212799 UTC
Result size of Tidy Core = {terms: 53, types: 46, coercions: 9}
-- RHS size: {terms: 2, types: 0, coercions: 0}
lvl_r4Ci
lvl_r4Ci = I# -1#
-- RHS size: {terms: 3, types: 2, coercions: 0}
lvl1_r4Cj
lvl1_r4Cj = : lvl_r4Ci []
-- RHS size: {terms: 2, types: 0, coercions: 0}
lvl2_r4Ck
lvl2_r4Ck = I# 1#
-- RHS size: {terms: 3, types: 1, coercions: 0}
lvl3_r4Cl
lvl3_r4Cl = : lvl2_r4Ck lvl1_r4Cj
Rec {
-- RHS size: {terms: 3, types: 1, coercions: 0}
xs_r4Cm
xs_r4Cm = ++ lvl3_r4Cl xs_r4Cm
end Rec }
-- RHS size: {terms: 1, types: 0, coercions: 0}
f
f = xs_r4Cm
-- RHS size: {terms: 3, types: 1, coercions: 0}
main3
main3 = $wunsafeTake 5# f
-- RHS size: {terms: 4, types: 2, coercions: 0}
main2
main2 = showList__ shows_$sshows11 main3 []
-- RHS size: {terms: 6, types: 2, coercions: 0}
main1
main1 = \ eta_a2aB -> hPutStr2 stdout main2 True eta_a2aB
-- RHS size: {terms: 1, types: 0, coercions: 3}
main
main = main1 `cast` ...
-- RHS size: {terms: 2, types: 1, coercions: 3}
main4
main4 = runMainIO1 (main1 `cast` ...)
-- RHS size: {terms: 1, types: 0, coercions: 3}
main
main = main4 `cast` ...
-- RHS size: {terms: 2, types: 0, coercions: 0}
$trModule2
$trModule2 = TrNameS "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
$trModule1
$trModule1 = TrNameS "Main"#
-- RHS size: {terms: 3, types: 0, coercions: 0}
$trModule
$trModule = Module $trModule2 $trModule1
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE Safe #-}
module Main where
import Prelude hiding (concat, repeat)
import GHC.OldList (concat, repeat)
main = print $ take 5 f
f = concat $ repeat [1 :: Int,-1]
{-# NOINLINE f #-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment