[Haskell-cafe] do we need types?

Pasqualino "Titto" Assini tittoassini at gmail.com
Fri Feb 26 07:35:57 EST 2010

Hi, just a silly question (or maybe more than one):

In Haskell we have data types (Integer,[a],...) as well as type
classes (Num, Ord...).

But, if we have type classes do we still need types?

Why shouldn't the objects that we process be defined only by their
'interfaces' (assuming that a type class is a kind of interface)?

Maybe the real question is: are type classes a more primitive concept
than data types?

And if so, in a language that had only type classes what would a data
declaration like the following map to:

data List a = Cons a (List a) | Nil

And what about pattern matching? Would that still be possible, and
what form would it take?

And finally, would having only type classes make the type system any simpler?



More information about the Haskell-Cafe mailing list