
Am I right in thinking that sets of sets don't really work with GHC's Data.Set because "Set a" things aren't instances of Ord? How should I do sets of sets with it? (e.g. Set.mkSet [Set.unitSet 1] gives "No instance for (Ord (Set a))") -- Mark

One work-around is to define something like: instance Ord e => Ord (Set e) where compare a b = compare (setToList a) (setToList b) should work fine and shouldn't be too inefficient (I asked a similar question a while back about FiniteMap, upon which Set is built). - Hal -- Hal Daume III "Computer science is no more about computers | hdaume@isi.edu than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume On Fri, 15 Nov 2002, Mark T.B. Carroll wrote:
Am I right in thinking that sets of sets don't really work with GHC's Data.Set because "Set a" things aren't instances of Ord? How should I do sets of sets with it?
(e.g. Set.mkSet [Set.unitSet 1] gives "No instance for (Ord (Set a))")
-- Mark
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

I had asked a similar question on haskell lists about how to implement hypergraphs efficiently, which are combinatorics of finite sets (sets of sets). As a matter of fact, I obtained a nice and small finite set implementation that works for me, let me see if it is worth posting. If you are working with larger than trivial hypergraphs and expensive algorithms performance can be a problem, so it would be better to surpass a suboptimal approach. Thanks, On Friday 15 November 2002 10:31 pm, Mark T.B. Carroll wrote:
Am I right in thinking that sets of sets don't really work with GHC's Data.Set because "Set a" things aren't instances of Ord? How should I do sets of sets with it?
(e.g. Set.mkSet [Set.unitSet 1] gives "No instance for (Ord (Set a))")
-- Mark
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
--
Eray Ozkural
participants (3)
-
Eray Ozkural
-
Hal Daume III
-
Mark T.B. Carroll