
Similar for Sets, lists, and FMs, I'd expect something like
instance Collection a where empty = ... (!!) cardinality -- or whatever
There is also the option of separating things even further, like class Size a where size :: a -> Int class Empty a where empty :: a ultimately each function is the (single) method of a class. for accessing an indexed collection , write class Bang c where (!!) : c a b -> a -> b (this is AssocX.lookup in Edison, http://www.haskell.org/ghc/docs/edison/users008.html#toc35) even better, since this is actually a (partial) mapping, change (!!) to ($), and we have unified notation for functions, arrays, lists, finite maps... not entirely joking, -- -- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ -- -- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/252 --