Proposal: add ordNub somewhere in containers

Eric Torreborre etorreborre at yahoo.com
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.

------------------------------------------------
Eric TORREBORRE
T +49 176 420 8383 4
E etorreborre at yahoo.com
P http://specs2.org
B http://etorreborre.blogspot.com
------------------------------------------------ 

    Le mardi 17 octobre 2017 à 11:05:43 UTC+2, Henning Thielemann <lemming at henning-thielemann.de> 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 haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20171017/8f38b1c2/attachment-0001.html>


More information about the Libraries mailing list