diff options
author | Joris | 2017-11-19 00:20:25 +0100 |
---|---|---|
committer | Joris | 2017-11-19 00:20:25 +0100 |
commit | 7194cddb28656c721342c2ef604f9f9fb0692960 (patch) | |
tree | 5b8c8562c9a1680aa315b4b7e10a3a7c22900863 /client/src/Util | |
parent | 42e94a45e26f40edc3ad71b1e77a4bf47c13fd3d (diff) |
Show payment count and partition
- Also fixes exceedingPayer in back by using only punctual payments
Diffstat (limited to 'client/src/Util')
-rw-r--r-- | client/src/Util/List.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/client/src/Util/List.hs b/client/src/Util/List.hs new file mode 100644 index 0000000..4e22ba8 --- /dev/null +++ b/client/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) |