foo:: Int -> Int -> Int
foo z x = if (z < 100)
then z * foo (z+(x*z)) z
else z
How would you print out(the integer z) an output every time it gets called from itself?Can you have function that returns an IO and Int? Do you need a secondary function?
For simplicity, you can use trace. However it’s not welcomed for real production code as it breaks referential transparency.
tracetakes aStringto print and a value to return.