Proposal: add ordNub somewhere in containers

Eric Torreborre etorreborre at
Tue Oct 17 09:18:49 UTC 2017

As a tangent I am interested in knowing what would be the typeclass for this sort of operation:
 - take all the elements out of `f a` - do something with them with a function a -> b - insert the results back to get the same "original shape" `f b`
In this case "do something with them" is "order them" but it could also be "invoke a function with all the 'a's and dispatch back the results" to allow "batching" function calls.

T +49 176 420 8383 4
E etorreborre at

    Le mardi 17 octobre 2017 à 11:05:43 UTC+2, Henning Thielemann <lemming at> a écrit :  
On Mon, 16 Oct 2017, David Feuer wrote:

> I would imagine
> ordNub :: (Foldable t, Ord a)
>        => t a -> [a]

The kind of generalization where the input is Foldable but the output is 
just a list looks pretty unnatural to me. I think it means that we still 
do not have the proper generalization that allows us to define

  ordNub :: (??? f, Ord a) => f a -> f a

I would just leave it as ordNub :: (Ord a) => [a] -> [a]_______________________________________________
Libraries mailing list
Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list