{-# LANGUAGE Rank2Types #-} -- Examples showing the limits of Hindley-Milner type inference: import Prelude hiding (id) -- Declare this function with a polymorphic function as first argument: funsum :: (forall a . [a] -> Int) -> [b] -> [c] -> Int funsum f xs ys = f xs + f ys mainfunsum = funsum length [1,2,3] "abc" -- Self application of argument possible if it is a polymoprhic function: fun :: (forall a. a -> a) -> a -> a fun g = g g id :: forall a . a -> a id x = x mainfun = (fun id) True