On Fri, Aug 19, 2016 at 05:49:30PM +0200, Paolino wrote:
> An example on sorting (Ord a, Ord b, Ord c) => [(a,(b,c)] with 'a' in
> opposite order, then 'c' and 'b' in ascending order goes like
>
> sortBy (comparings [Descending fst, Ascending $ snd . snd, Ascending $ fst
> . snd])
The answer is: Yes! Haskell can do that:
sortBy (flip (comparing fst)
<> comparing (snd . snd)
<> comparing (fst . snd))
:: (Ord a, Ord b, Ord a1) => [(a, (a1, b))] -> [(a, (a1, b))]
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell- cafe
Only members subscribed via the mailman list are allowed to post.