Data.Set API

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Data.Set API

Iavor Diatchki
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?
It did not use to be there in the old implementation.
-Iavor
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Data.Set API

Tomasz Zielonka
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
_______________________________________________
Libraries mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/libraries