[Haskell-cafe] lists as instances of a class?

Bayley, Alistair Alistair_Bayley at invescoperpetual.co.uk
Mon Jul 10 11:13:39 EDT 2006

> From: haskell-cafe-bounces at haskell.org 
> [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Spencer Janssen
> The problem isn't with lists specifically, but  with any instance that
> applies types (rather than type variables) to a type constructor
> >From section 4.3.2 of The Haskell 98 Report: "The type (T u1 ... uk)
> must take the form of a type constructor T applied to simple type
> variables u1, ... uk".  I've run into this restriction several times
> myself, and I'm also curious whether this will change in Haskell'.
> Spencer Janssen

Sorry, I'm struggling with this. Why is [] not of the form (T a b c ...)

I assume that [] is syntactic sugar for something like:

data List a = Cons a | Nil   ===>?  data [a] = (:) a | []

so [Double] is just sugar for List Double, which appears to me to be of
the form (T a b c ...).

What subtlety am I missing?

Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.

More information about the Haskell-Cafe mailing list