
A few more questions. (I've been trying to make a list instance of a set) 1. Which is better to use:
class (Eq elem) => Set setTC elem where ... instance (Eq elem) => Set [] elem where ...
or
class (Eq elem) => Set set elem | set -> elem where ... instance (Eq elem) => Set [elem] elem where ...
(I do need the functional dependency, because the set type, as being parametric, defines its element type?) The second one seemd easier to use at first when writing type signatures, but after a little fiddling, I got the other one working also. 2. Is there a way to make another instance for list as a set, when the element besides being instance of Eq, but also then of Ord (instead of just writing another class called OrdSet)? This is to take advandage of the Ord class -- like having a sorted list of elements. Then, for inserting or checking for membership, I could look only as far as I need in the list. 3. Lastly, I was thinking, that for elements from Enum types could use a bit-array for even faster set operations. Should I make other types (like lists and trees) instances of the Set class, or, instead, make a set type, and have it have many constructors for many data-structures? Markus