I thought -XStrict was supposed turn GHC into a Strict Haskell, so I tried the infinite Fibonacci sequence test
my_zipWith f x [] = []
my_zipWith f [] y = []
my_zipWith f (x:xt) (y:yt) = f x y : my_zipWith f xt yt
test_fibs n =
let fibs = 0 : 1 : my_zipWith (+) fibs (tail fibs) in
take n fibs
main = do
putStr $ show $ test_fibs 15
to see if it would blow up in memory, but it doesn't:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2
$ ghc -XStrict fibs.hs && ./fibs
[1 of 1] Compiling Main ( fibs.hs, fibs.o )
Linking fibs ...
[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]
What am I doing wrong?