Created
May 16, 2014 02:08
-
-
Save bergmark/792058a0af0a26775612 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- $ ghc -ddump-simpl -dsuppress-all Fib.hs -fforce-recomp -O2 | |
| [1 of 1] Compiling Fib ( Fib.hs, Fib.o ) | |
| ==================== Tidy Core ==================== | |
| Result size of Tidy Core = {terms: 52, types: 59, coercions: 0} | |
| fibs3 | |
| fibs3 = __integer 1 | |
| fibs4 | |
| fibs4 = __integer 0 | |
| fail_rPQ | |
| fail_rPQ = \ _ -> patError "Fib.hs:4:5-39|function next"# | |
| lvl_rPR | |
| lvl_rPR = fail_rPQ void# | |
| Rec { | |
| $wnext_rPS | |
| $wnext_rPS = | |
| \ w_sP2 -> | |
| case w_sP2 of _ { | |
| [] -> case lvl_rPR of wild1_00 { }; | |
| : a_arO t_arP -> | |
| case t_arP of wild1_Xp { | |
| [] -> case lvl_rPR of wild2_00 { }; | |
| : b_arQ ds_dOi -> | |
| (# plusInteger a_arO b_arQ, | |
| case $wnext_rPS wild1_Xp of _ { (# ww1_sP7, ww2_sP8 #) -> | |
| : ww1_sP7 ww2_sP8 | |
| } #) | |
| } | |
| } | |
| end Rec } | |
| Rec { | |
| fibs1 | |
| fibs1 = : fibs3 fibs2 | |
| fibs | |
| fibs = : fibs4 fibs1 | |
| fibs2 | |
| fibs2 = | |
| case $wnext_rPS fibs of _ { (# ww1_sP7, ww2_sP8 #) -> | |
| : ww1_sP7 ww2_sP8 | |
| } | |
| end Rec } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- $ ghc -ddump-simpl -dsuppress-all Fib.hs -fforce-recomp | |
| [1 of 1] Compiling Fib ( Fib.hs, Fib.o ) | |
| ==================== Tidy Core ==================== | |
| Result size of Tidy Core = {terms: 47, types: 47, coercions: 0} | |
| a_rL7 | |
| a_rL7 = __integer 1 | |
| a1_rM3 | |
| a1_rM3 = __integer 0 | |
| next_rM4 | |
| next_rM4 = | |
| \ @ a4_aLj $dNum_aLk eta_B1 -> | |
| letrec { | |
| next1_aIB | |
| next1_aIB = | |
| \ ds_dLJ -> | |
| let { | |
| fail_dLL | |
| fail_dLL = \ _ -> patError "Fib.hs:4:5-39|function next"# } in | |
| case ds_dLJ of _ { | |
| [] -> fail_dLL void#; | |
| : a5_apx t_apy -> | |
| case t_apy of wild1_Xp { | |
| [] -> fail_dLL void#; | |
| : b_apz ds1_dLK -> | |
| : (+ $dNum_aLk a5_apx b_apz) (next1_aIB wild1_Xp) | |
| } | |
| }; } in | |
| next1_aIB eta_B1 | |
| Rec { | |
| a2_rM5 | |
| a2_rM5 = : a_rL7 a3_rM6 | |
| fibs | |
| fibs = : a1_rM3 a2_rM5 | |
| a3_rM6 | |
| a3_rM6 = next_rM4 $fNumInteger fibs | |
| end Rec } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Fib where | |
| fibs = 0 : 1 : next fibs | |
| where | |
| next (a : t@(b:_)) = (a+b) : next t |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- $ ghc -ddump-simpl -dsuppress-all Fib2.hs -fforce-recomp -O2 | |
| [1 of 1] Compiling Fib ( Fib2.hs, Fib2.o ) | |
| ==================== Tidy Core ==================== | |
| Result size of Tidy Core = {terms: 52, types: 59, coercions: 0} | |
| fibonacci3 | |
| fibonacci3 = __integer 1 | |
| fibonacci4 | |
| fibonacci4 = __integer 0 | |
| fail_rPO | |
| fail_rPO = \ _ -> patError "Fib2.hs:4:5-43|function next"# | |
| lvl_rPP | |
| lvl_rPP = fail_rPO void# | |
| Rec { | |
| $wnext_rPQ | |
| $wnext_rPQ = | |
| \ w_sP0 -> | |
| case w_sP0 of _ { | |
| [] -> case lvl_rPP of wild1_00 { }; | |
| : a_arO ds_dOj -> | |
| case ds_dOj of wild1_Xp { | |
| [] -> case lvl_rPP of wild2_00 { }; | |
| : b_arP rest_arX -> | |
| (# plusInteger a_arO b_arP, | |
| case $wnext_rPQ wild1_Xp of _ { (# ww1_sP5, ww2_sP6 #) -> | |
| : ww1_sP5 ww2_sP6 | |
| } #) | |
| } | |
| } | |
| end Rec } | |
| Rec { | |
| fibonacci1 | |
| fibonacci1 = : fibonacci3 fibonacci2 | |
| fibonacci | |
| fibonacci = : fibonacci4 fibonacci1 | |
| fibonacci2 | |
| fibonacci2 = | |
| case $wnext_rPQ fibonacci of _ { (# ww1_sP5, ww2_sP6 #) -> | |
| : ww1_sP5 ww2_sP6 | |
| } | |
| end Rec } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- $ ghc -ddump-simpl -dsuppress-all Fib2.hs -fforce-recomp | |
| [1 of 1] Compiling Fib ( Fib2.hs, Fib2.o ) | |
| ==================== Tidy Core ==================== | |
| Result size of Tidy Core = {terms: 49, types: 48, coercions: 0} | |
| a_rL8 | |
| a_rL8 = __integer 1 | |
| a1_rM4 | |
| a1_rM4 = __integer 0 | |
| next_rM5 | |
| next_rM5 = | |
| \ @ a4_aLk $dNum_aLl eta_B1 -> | |
| letrec { | |
| next1_aIB | |
| next1_aIB = | |
| \ ds_dLK -> | |
| let { | |
| fail_dLM | |
| fail_dLM = \ _ -> patError "Fib2.hs:4:5-43|function next"# } in | |
| case ds_dLK of _ { | |
| [] -> fail_dLM void#; | |
| : a5_apx ds1_dLL -> | |
| case ds1_dLL of _ { | |
| [] -> fail_dLM void#; | |
| : b_apy rest_apG -> | |
| : (+ $dNum_aLl a5_apx b_apy) (next1_aIB (: b_apy rest_apG)) | |
| } | |
| }; } in | |
| next1_aIB eta_B1 | |
| Rec { | |
| a2_rM6 | |
| a2_rM6 = : a_rL8 a3_rM7 | |
| fibonacci | |
| fibonacci = : a1_rM4 a2_rM6 | |
| a3_rM7 | |
| a3_rM7 = next_rM5 $fNumInteger fibonacci | |
| end Rec } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Fib where | |
| fibonacci = 0 : 1 : next fibonacci | |
| where | |
| next (a:b:rest) = (a+b) : next (b:rest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment