[Haskell-cafe] Data.Set subset function?

Christian Maeder maeder at tzi.de
Thu Jul 22 07:58:06 EDT 2004


Graham Klyne wrote:
> I don't see a subset function in Data.Set.  What is the preferred way to 
> define this?
> 
> I currently have:
> 
>   a `subset` b = isEmptySet (a `minusSet` b)

Maybe add a speedup: size a <= size b && isEmptySet (a `minusSet` b)
(Computing the size should be cheap)

> (Hmmm... does library style prefer `subset`, `subsetOf`, `isSubset`, 
> `isSubsetOf` ?)

According to http://users.skynet.be/jyp/DData/doc/
it should be `isSubsetOf` (but `subset` is also fine for me)

Christian



More information about the Haskell-Cafe mailing list