
I started like this: {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} import qualified Data.List as L class (Eq e) => Set s e where empty :: s e fromList :: [e] -> s e ... ..and started to implement it on a list: instance (Eq e) => Set [] e where empty = [] fromList xs = L.nub xs But I can't understand, why there has to be a (Eq a) context to the Set instance of a list, when the class definition seems to already say it? It won't compile without it.. Secondly, why do I need FlexibleInstances -- it gives me an eror which I don't understand ("all instance types must be of the form T a1 ... an" and so on, and recommends to add the flexible instances.) Also I couldn't find other elaborate Set typeclasses -- there seems to be only the "Set a" type. Why is that(?), because you could use other datastructures, better and worse in various ways, than the balanced binary tree.. Markus