Created
May 18, 2014 08:10
-
-
Save osa1/319c64a38c93b57559a5 to your computer and use it in GitHub Desktop.
This file contains 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
{-# LANGUAGE LambdaCase #-} | |
fib :: Integer -> Integer | |
fib 0 = 1 | |
fib 1 = 1 | |
fib n = fib (n - 1) + fib (n - 2) | |
fib' :: Integer -> Integer | |
fib' = \case | |
0 -> 1 | |
1 -> 1 | |
n -> fib' (n - 1) + fib' (n - 2) | |
main = do | |
print $ fib 30 | |
print $ fib' 30 |
This file contains 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
➜ exception-test ghcjs -prof -fprof-auto exceptions.hs -O0 | |
generating native | |
[1 of 1] Compiling Main ( exceptions.hs, exceptions.o ) | |
generating JavaScript | |
[1 of 1] Compiling Main ( exceptions.hs, exceptions.js_o ) | |
genToplevelDecl for id: fib | |
ignoring StgRhsClosure with free vars: [] with CCS: CCS_DONT_CARE | |
ignoring StgSCC with CC: fib | |
genToplevelDecl for id: fib' | |
ignoring StgRhsClosure with free vars: [] with CCS: CAF_ccs | |
ignoring StgSCC with CC: fib' | |
ignoring StgSCC with CC: fib' | |
ignoring StgSCC with CC: fib'.\ | |
ignoring StgSCC with CC: fib'.\ | |
ignoring StgSCC with CC: fib'.\ | |
genToplevelDecl for id: Main.main | |
ignoring StgRhsClosure with free vars: [] with CCS: CAF_ccs | |
ignoring StgSCC with CC: main | |
genToplevelDecl for id: :Main.main | |
ignoring StgRhsClosure with free vars: [] with CCS: CAF_ccs | |
Linking exceptions.jsexe (Main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment