Am 18.07.2014 21:57, schrieb Greg Weber:It's also in my utility package:
I think the `By` functions that expect a Bool are all cumbersome because
they are too flexible. 100% of the time I personally use these functions
I want to use Ord or Eq.
What I would like to see is a function groupOn next to groupBy.
groupOn :: Eq b => (a -> b) -> [a] -> [[a]]
Then equating is no longer needed, and one just writes: groupOn snd
I believe this style also gives better opportunity for optimization
(Scwartzian transform).
http://hackage.haskell.org/package/utility-ht-0.0.10/docs/Data-List-Key.html
I have also a version of 'groupBy' that returns a list of non-empty lists:
http://hackage.haskell.org/package/non-empty-0.2/docs/Data-NonEmpty-Mixed.html#v:groupBy
It's all Haskell 98.