Sets

Hal Daume III hdaume@ISI.EDU
Fri, 15 Nov 2002 12:51:35 -0800 (PST)


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
>