> Sill I want to make objects packed with their objects and
> functions. Doesn't mean that I have to use existential data types?

Only if you need to hide the type of the object.

If you don't need to hide the type then Haskell's typeclasses
give you (what I understand of) what you want.

I can write polymorphic functions which take an arbitrary type of object
and invoke methods like ==, + and show (say) on it.

  foo :: (Eq a, Num a) => a -> String
  foo x = if x == 0 then "" else show (x+1)


Actually, I suspect this is not quite what you want but the word
'object' has been used by so many people to mean so many things that
it's only by throwing out strawmen like Haskell's typeclasses that we
can understand what you actually do mean.

--
Alastair Reid                 [EMAIL PROTECTED]  
Reid Consulting (UK) Limited  http://www.reid-consulting-uk.ltd.uk/alastair/


_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to