Printf doesn't work? But it works in GHCi interactively.
Consider the trivial program
import Text.Printf
main = do
printf "%f\n" pi
return ()
When I put this into a file printf.hs and try to compile it (using GHCi or GHC) there is a type ambiguity that cannot be resolved using explicit casting of pi to Double. This is not different from examples that appear in Real World Haskell book. I also tried using "%g\n" instead of "%f\n".
On the other hand, this is what happens in GHCi interactively:
> pf1 = printf "%f\n" pi
> pf1
3.1415926535...
I'm using GHC v 10.8.4 under Windows.