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@yahoo.com
P http://specs2.org
B http://etorreborre.blogspot.com
------------------------------------------------


Le mardi 17 octobre 2017 à 11:05:43 UTC+2, Henning Thielemann <lemming@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@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries