{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} module Polymorphism where foo :: a -> a -> a foo :: a -> a -> a foo = a -> a -> a forall a. HasCallStack => a undefined foo' :: forall a. a -> a -> a foo' :: a -> a -> a foo' = a -> a -> a forall a. HasCallStack => a undefined bar :: a -> b -> (a, b) bar :: a -> b -> (a, b) bar = a -> b -> (a, b) forall a. HasCallStack => a undefined bar' :: forall a b. a -> b -> (a, b) bar' :: a -> b -> (a, b) bar' = a -> b -> (a, b) forall a. HasCallStack => a undefined baz :: a -> (a -> [a -> a] -> b) -> b baz :: a -> (a -> [a -> a] -> b) -> b baz = a -> (a -> [a -> a] -> b) -> b forall a. HasCallStack => a undefined baz' :: forall a b. a -> (a -> [a -> a] -> b) -> b baz' :: a -> (a -> [a -> a] -> b) -> b baz' = a -> (a -> [a -> a] -> b) -> b forall a. HasCallStack => a undefined quux :: a -> (forall a. a -> a) -> a quux :: a -> (forall a. a -> a) -> a quux a x forall a. a -> a f = a -> a forall a. a -> a f a x quux' :: forall a. a -> (forall a. a -> a) -> a quux' :: a -> (forall a. a -> a) -> a quux' a x forall a. a -> a f = a -> a forall a. a -> a f a x num :: Num a => a -> a -> a num :: a -> a -> a num = a -> a -> a forall a. HasCallStack => a undefined num' :: forall a. Num a => a -> a -> a num' :: a -> a -> a num' = a -> a -> a forall a. HasCallStack => a undefined eq :: (Eq a, Eq b) => [a] -> [b] -> (a, b) eq :: [a] -> [b] -> (a, b) eq = [a] -> [b] -> (a, b) forall a. HasCallStack => a undefined eq' :: forall a b. (Eq a, Eq b) => [a] -> [b] -> (a, b) eq' :: [a] -> [b] -> (a, b) eq' = [a] -> [b] -> (a, b) forall a. HasCallStack => a undefined mon :: Monad m => (a -> m a) -> m a mon :: (a -> m a) -> m a mon = (a -> m a) -> m a forall a. HasCallStack => a undefined mon' :: forall m a. Monad m => (a -> m a) -> m a mon' :: (a -> m a) -> m a mon' = (a -> m a) -> m a forall a. HasCallStack => a undefined norf :: a -> (forall a. Ord a => a -> a) -> a norf :: a -> (forall a. Ord a => a -> a) -> a norf a x forall a. Ord a => a -> a f = a x norf' :: forall a. a -> (forall a. Ord a => a -> a) -> a norf' :: a -> (forall a. Ord a => a -> a) -> a norf' a x forall a. Ord a => a -> a f = a x plugh :: forall a. a -> a plugh :: a -> a plugh a x = a x :: a thud :: forall a b. (a -> b) -> a -> (a, b) thud :: (a -> b) -> a -> (a, b) thud a -> b f a x = (a x :: a, b y) :: (a, b) where y :: b y = (a -> b f :: a -> b) a x :: b