Beginner question -- what do you usually use as a multimap? I want a function that takes a labelling function and partitions elements by each label. For example,
f x | x `mod` 2 == 0 = EVEN
| otherwise = ODD
the output of partition f lst
where lst :: [Int]
would be
EVEN --> [list of even numbers]
ODD --> [sublist of odd numbers]
Sorry for the bother, I could not find something similar on Hoogle. I think I can get there via Data.List.Key
's group
function, sort
, and some mapping, but there must be a simpler way, no? This seems like a generally useful function.