Data.Set API

Tomasz Zielonka tomasz.zielonka at gmail.com
Mon Nov 21 16:49:41 EST 2005


On Mon, Nov 21, 2005 at 01:28:40PM -0800, Iavor Diatchki wrote:
> Hello,
> I just noticed that the type of Data.Set.map is
> (Ord a, Ord b) => (a -> b) -> Set a -> Set b
> Is the 'Ord a' constraint really neccessary?

I guess not, because you can define:

    map' :: (Ord b) => (a -> b) -> Set a -> Set b
    map' f = fromList . map f . toList

Did the more restrictive type bite you in practice?

Best regards
Tomasz


More information about the Libraries mailing list