diff options
author | Joris | 2019-11-07 07:59:41 +0100 |
---|---|---|
committer | Joris | 2019-11-07 07:59:41 +0100 |
commit | 4dc84dbda7ba3ea60d13e6f81eeec556974b7c72 (patch) | |
tree | 14cca21a981a55049710b85c5f81a18ce836d6b9 /server/src/Util | |
parent | f4f24158a46d8c0975f1b8813bbdbbeebad8c108 (diff) |
Show payment header infos
Diffstat (limited to 'server/src/Util')
-rw-r--r-- | server/src/Util/List.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/src/Util/List.hs b/server/src/Util/List.hs new file mode 100644 index 0000000..4e22ba8 --- /dev/null +++ b/server/src/Util/List.hs @@ -0,0 +1,13 @@ +module Util.List + ( groupBy + ) where + +import Control.Arrow ((&&&)) +import Data.Function (on) +import qualified Data.List as L + +groupBy :: forall a b. (Ord b) => (a -> b) -> [a] -> [(b, [a])] +groupBy f = + map (f . head &&& id) + . L.groupBy ((==) `on` f) + . L.sortBy (compare `on` f) |