Proposal: composition util for Maps

Alexandre Esteves alexandre.fmp.esteves at gmail.com
Sun Jul 7 17:22:11 UTC 2019


In https://github.com/haskell/containers/issues/647 I proposed the
following util:

composition :: Ord b => Map b c -> Map a b -> Map a c
composition bc ab = flip mapMaybe ab $ flip lookup bc

Which has O(|ab| * log |bc|) performance. It's not particularly hard to
write, but it does feel like a primitive-ish operation, and it's not
obvious to me whether there's a faster implementation.

Other name suggestions
- (.)
- chain
- compose
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190707/d96f9d0e/attachment.html>


More information about the Libraries mailing list