I didn't expect the following code to work:
foo :: (Num a) => a -> a foo x = x + x main = do print (foo (read "7"))
because it is not possible to fully infer the type of (read "7") based on the code. But GHC (6.12.3) thinks otherwise and prints 14.
If "7" is changed to "7.2", the code fails with "no parse". What's going on here? how is Haskell deciding which instance of Read to use?