Skip to content

Instantly share code, notes, and snippets.

@AndreasPK
Created July 8, 2022 21:47
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 AndreasPK/448ac60e5caab642b5181a6ea21fce3f to your computer and use it in GitHub Desktop.
Save AndreasPK/448ac60e5caab642b5181a6ea21fce3f to your computer and use it in GitHub Desktop.
-- -fno-worker-wrapper -dno-typeable-binds just makes the resulting dump easier to understand.
-- Try uncommenting the second OPTIONS pragma to see the difference float out makes.
{-# OPTIONS_GHC -O -fno-worker-wrapper -ddump-simpl -dsuppress-all -ddump-to-file -fforce-recomp #-}
-- {-# OPTIONS_GHC -fno-full-laziness #-}
module Main(main,g) where
import GHC.Exts
{-# NOINLINE f #-}
f x y = x + y :: Int
g = map (\x -> f (nfib 15) x) [1..1000]
nfib :: Int -> Int
nfib n = if n <= 1 then 1 else nfib (n-1) + nfib (n-2) + 1
main = print $ sum g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment