
John Impredicative polymorphism has always been a soggy area of GHC -- the mixture of type inference and impredicativity is a genuinely difficult problem as you'll see from reading the papers. GHC 7 is less ambitious than GHC 6, and does a bit less. Tim Sheard, Dimitrios Vytiniotis and I are working on a solid story. But meanwhile GHC's current implementation is a bit unpredictable, frankly. My advice: use a newtype to wrap up the polymorphism: newtype Denamer = MkD (forall n. Denamable n => n -> n) getDeName :: Tc Denamer Simon | -----Original Message----- | From: glasgow-haskell-users-bounces@haskell.org [mailto:glasgow-haskell- | users-bounces@haskell.org] On Behalf Of John Meacham | Sent: 31 January 2012 20:58 | To: glasgow-haskell-users@haskell.org | Subject: Impredicative types error | | Hi, I am running into an issue where some code that compiled and | worked under 6.12 is failing under 7.0, the offending code is | | class DeNameable a where | deName :: Module -> a -> a | | getDeName :: Tc (DeNameable n => n -> n) | getDeName = do | mn <- asks (tcInfoModName . tcInfo) | return (\n -> deName mn n) | | Tc is a plain typechecking monad and this returns a generic denaming | function that can be used to turn haskell names back into human | readable form before printing errors in jhc. | | I have the ImpredicativeTypes LANGUAGE feature turned on. | | the error I get under 7.0 is | | src/FrontEnd/Tc/Monad.hs:131:29: | Couldn't match expected type `n -> n' | with actual type `DeNameable n' | In the second argument of `deName', namely `n' | In the expression: deName mn n | In the first argument of `return', namely `(\ n -> deName mn n)' | | John | | _______________________________________________ | Glasgow-haskell-users mailing list | Glasgow-haskell-users@haskell.org | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users