[Haskell-cafe] Question about kinds

Edsko de Vries devriese at cs.tcd.ie
Sat Jun 7 04:41:46 EDT 2008


On Fri, Jun 06, 2008 at 03:41:07PM -0700, Klaus Ostermann wrote:
> 
> Why does the code below not pass the type checker?
> 
> If I could explictly parameterize y with the type constructor Id (as e.g. in
> System F), then 'y Id' should have the type Int -> Int
> and hence "y Id x" should be OK, but with Haskell's implicit type parameters
> it does not work.

The type of 'Id' is expanded to simply 'Int', and 'Int' does not unify
with 'm a' for any type constructor 'm': Haskell's type level functions
are always unevaluated (type synonyms don't count: they are always
expanded).

So, if you wanted to to this, you'd need to do

  newtype Id a = Id a

Of course, now your values need to be tagged as well.

Edsko


More information about the Haskell-Cafe mailing list