Type variable escapes when encoding existential types
Consider the following program.
{-# LANGUAGE RankNTypes #-}
data Showable = Showable (forall b. (forall a. Show a => a -> b) -> b)
showable x = Showable (\f -> f x)
f :: Showable -> String
f showable = case showable of
Showable f -> let k x = show x in f k
While this program compiles in GHC, our frontend rejects it with the following error message.
Ambiguous type variable _17
in type Prelude.Show _17 => Showable -> [Prelude.Char]
inferred for equation
f showable =
case showable of
Showable f -> let k x = show x in f k
Edited by Jan-Hendrik Matthes