The function f
indeed complete. It returns a value for any input. In particular, it produces the same value each time.
The value is an IO action that, when executed, is likely to terminate the program if not executed in a context that might deal with the error. But this does not matter, since just applying f
does not trigger the IO action.
Here is an example program that uses f
:
main = putStrLn $ show $ length $ map (f$) [1,2,3]
and he should print
3
source share