Re: [Haskell-cafe] Question about kinds

2008-06-07 Thread Derek Elkins
On Fri, 2008-06-06 at 15:41 -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

Re: [Haskell-cafe] Question about kinds

2008-06-07 Thread Luke Palmer
On Fri, Jun 6, 2008 at 4:41 PM, Klaus Ostermann [EMAIL PROTECTED] wrote: type Id a = a x :: Id Int x = undefined y :: (a Int) - (a Int) y = undefined In a Int, a refers to any type constructor, not any type function. So the best you can do is: newtype Id a = Id a -- rest as before Luke

Re: [Haskell-cafe] Question about kinds

2008-06-07 Thread Edsko de Vries
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

Re: [Haskell-cafe] Question about kinds

2008-06-07 Thread Ryan Ingram
type declarations are not first-class; treat them more like macro expansions. In particular, you cannot make a function polymorphic over a type declaration. You can make this typecheck using a data or newtype declaration for Id: newtype Id x = Identity x (or) data Id x = Identity x You do need

Re: [Haskell-cafe] Question about kinds

2008-06-07 Thread Claus Reinke
short answer: use newtype instead of type (and check the language spec for the difference between the two). Why does the code below not pass the type checker? because of the type error?-) seriously, though, it is useful to accompany such questions with some indication of what you're trying to

[Haskell-cafe] Question about kinds

2008-06-06 Thread Klaus Ostermann
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. So, how can I make