Type Families and defaults

Simon Peyton-Jones simonpj at microsoft.com
Mon Sep 6 03:37:52 EDT 2010


Mitar, and others

Yes, I've spent most of the last month working on the new type checker, and unless there's a major hiccup it'll be in GHC 7.0.  We'll produce a release candidate just before ICFP.

However, as it happens both your tests compile with GHC 6.12, if you add ScopedTypeVariables.  The trouble is that your type signatures like (IO n) are read as (forall n. IO n). 

It's a bit unfortunate that there isn't a more coherent warning about this.  Suppose you write

	class C a where  
        op :: a -> a
        op = .....(e :: a -> a)....

Then the "a->a" signature means (in Haskell98) forall a. a->a.  

I suppose that I could add a warning that says more or less

  Warning: type signature implicitly quantifies over 'a',
    but if ScopedTypeVariables was on, type variable 'a'
    would be in scope here, so the type signature would not
    be quantified

It's not trivial to add, but not really hard either.  Has anyone else been bitten by this?

Simon



More information about the Glasgow-haskell-users mailing list