> > the goal of type class is to allow overloading of function, so for example > id x = x is not subject to overloading => no use to put it in a type class.
Because it doesn't do anything? > > elem :: Eq a => a -> [a] -> Bool > > map :: (a -> b) -> [a] -> [b] > > > > class Container a where > > elem :: Eq b => b -> a b -> Bool > > map :: (b -> c) -> a b -> a c > > > > would define methods that can work on all containers, and create a > > discipline to write more reusable and generic functions. > > yes, that's right that map and elem could be put in a type class, but that's hard and require > more advanced feature of haskell (here you use constructor class but you need more : multi-parameter class, ....) > see http://www.cse.ogi.edu/~mpj/fds.html. > You shouldn't be using multi paramater type classes in place of type constructors. Then you will have the ambiguity problems that you mention on you web site. Multi parameter type classes have the benefit of using multi dispatch based on two non related types. _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe