
20 Dec
2020
20 Dec
'20
12:53 p.m.
On Sun, 20 Dec 2020, Ignat Insarov wrote:
* From a finite map, get a map from its range to its fibers:
fibers ∷ (Ord k, Ord v) ⇒ Map k v → Map v (NonEmpty k)
Why NonEmpty, and not Set? Or any Monoid? And more importantly, who are we to decide? Again, the cost difference between maintaining and re-discovering one "standard" vs. re-implementing something more precisely suited to the task at hand via (e.g.) Data.Map.foldMapWithKey doesn't seem worth it.
Because a fiber is non-empty. Ideally, sure, I would like `(k, Set k)`.
NonEmptyMap (and NonEmptySet?) were already discussed here. I also have: https://hackage.haskell.org/package/non-empty-0.3.2/docs/Data-NonEmpty-Set.h...