| > The reason, which is thoroughly explained in Simon Peyton-Jones' | > message, is that the given type signature is wrong: it should read | > f1 :: (exists b. (C Int b) => Int -> b)
Can you give an example of its use?
Yes, I can.
class (Show a, Show b) => C a b | a -> b where doit:: a -> b -> String
instance C Int Int where doit a b = (show a)
instance C Bool Bool where doit a b = if a then "everything" else "nothing"
newtype M a = M (forall b.(C a b) => b) f :: Int -> M Int f x = M undefined
g :: Bool -> M Bool g x = M undefined
test1 a = case (f a) of M b -> doit a b
test2 a = case (g a) of M b -> doit a b
I wonder if the Obfuscated Haskell contest has an entry for the most useless type (with no uses). However, if a type can be used for the contest, it is no longer the most useless. This makes one wonder if the rules of the contest implicitly contain the Russel paradox.