
--let-bound polymorphism (Hindley-Milner type system) prevents instantiation of lambda-bound functions in two ways:

let f g = (g 5, g 'c') in f (\x -> x)

{--
    No instance for (Num Char) arising from the literal ‘5’
    In the first argument of ‘g’, namely ‘5’
    In the expression: g 5
    In the expression: (g 5, g 'c')
--}

pp3 :: (Show a, Num a) => a -> IO ()
pp3 = \x -> print (x+3)
---If type annotation not given, it wrongly infers:
---pp3 :: Integer -> IO ()
---which gives an error on Main> pp3 4.5

---Haskell in interpreter mode (ghci) seems to infer the right type,
---but not on compiler mode (using "load-file").