Minor containers API changes
Ivan Lazar Miljenovic
ivan.miljenovic at gmail.com
Tue Nov 29 04:20:10 CET 2011
On 29 November 2011 14:09, Johan Tibell <johan.tibell at gmail.com> wrote:
> On Mon, Nov 28, 2011 at 5:29 PM, Kazu Yamamoto <kazu at iij.ad.jp> wrote:
>> Hello,
>>
>> This is off-topic but I'm curious.
>>
>> Why the container package does not provide a type-class to unify APIs?
>> Are there any technical/historical reasons?
>
> Mostly technical I would say. I hope we should be able to do this
> right now when we have constraint kinds [1] i.e. we can do something
> like:
>
> class Map m where
> type C :: Constraints
> insert :: C => k -> v -> Map k v -> Map k v
>
> instance Map HashMap where
> type C = Ord
> insert = ...
>
> 1. http://blog.omega-prime.co.uk/?p=127
Definitely: this kind of thing was what stopped me when I tried to do
something similar last year. There's still the tension of whether to
put particular functions as class methods or not though (e.g. just
look at these proposals about whether to include certain functions).
--
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com
More information about the Libraries
mailing list