[Haskell-cafe] Defining a containing function on polymorphic list

Miguel Mitrofanov miguelimo38 at yandex.ru
Mon Dec 22 13:55:27 EST 2008

On 22 Dec 2008, at 17:35, Raeck Zhao wrote:

> But I just found another 'problem', I just realize that the list  
> does not support the user-defined data type?

Don't worry, it does.

> the list is also depending on the Eq function?

No, it doesn't.

> data Shape = Square | Triangle | Circle
> [Square, Triangle, Circle]

Should work fine.

> or
> Square == Square

Wouldn't work unless you declare your type "Shape" an instance of  
class "Eq" - which can be done automatically.

More information about the Haskell-Cafe mailing list