Impredicative types error

John Meacham john at repetae.net
Tue Jan 31 21:57:39 CET 2012


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



More information about the Glasgow-haskell-users mailing list