deriving over renamed types

Ashley Yakeley
Wed, 3 Apr 2002 15:36:01 -0800

At 2002-04-03 15:14, Hal Daume III wrote:

>if I replace
>> type FM = FiniteMap
>> type FM a b = FiniteMap a b
>it works fine.  I wasn't aware there was (supposed to be) a difference
>between these two declarations?  Is there?

I don't know about your example, but there is a difference.

  type FM = FiniteMap

...This defines FM as a type-constructor of kind (* -> * -> *) equivalent 
to FiniteMap.

  type FM a b = FiniteMap a b

...This defines FM as a pseudo-type-constructor. It has no kind, but must 
be specified with two arguments each of kind (*) so as to become a 
type-constructor (a type) of kind (*).

Unfortunately Haskell does not have lambda over types, otherwise the two 
could be the same. And then one could do things such as

  type M b a = a -> b;
  instance Cofunctor (M b) where ...

...which would be very useful, but would probably have unpleasant 
consequences for type inference...

Ashley Yakeley, Seattle WA