That quote shows that the author kinda misses the point here.
type FibPair = (Int, Int)
fibSeed :: FibPair
fibSeed = (0, 1)
fibNext :: FibPair -> FibPair
fibNext (p, v) = (v, v + p)
fibList :: [FibPair]
fibList = iterate fibNext fibSeed
The above code does exactly the same as his Fibonacci example, and it's written in pure Haskell. I'd argue the above is way more readable.I get the following output:
0 1 1 2 3 5 8 13 21 34
With the following main function: main :: IO ()
main = putStrLn . unwords . map (show . fst) . take 10 $ fibList
Which just takes the first element of each generated tuple, maps it to the string representation, and then adds a space between each number.