<div dir="auto">I have one minor operational concern. Set is strict in its keys, so code doesn't have to check whether a key is evaluated when case matching on it. Arg, on the other hand, is lazy in both arguments. So this function throws away evaluatedness information, which is always a bit sad.<div dir="auto"><br></div><div dir="auto">Separately, I'd love see:</div><div dir="auto"><br></div><div dir="auto">1. A function going the other way.</div><div dir="auto">2. Unsafe mapMonotonic-style functions generalizing both.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 27, 2022, 8:25 PM Joseph C. Sible <<a href="mailto:josephcsible@gmail.com">josephcsible@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I opened <a href="https://github.com/haskell/containers/issues/814" rel="noreferrer noreferrer" target="_blank">https://github.com/haskell/containers/issues/814</a> about adding<br>
this function to the containers package:<br>
<br>
import qualified Data.Map.Internal as Map<br>
import qualified Data.Set.Internal as Set<br>
import Data.Semigroup (Arg(..))<br>
<br>
mapToArgSet :: Map.Map k a -> Set.Set (Arg k a)<br>
mapToArgSet Map.Tip = Set.Tip<br>
mapToArgSet (Map.Bin sz k v l r) = Set.Bin sz (Arg k v) (mapToArgSet<br>
l) (mapToArgSet r)<br>
<br>
Does anyone have any suggestions or improvements for this? In<br>
particular, I'm sure there's a less clunky name that I just can't<br>
think of.<br>
<br>
Thanks,<br>
<br>
Joseph C. Sible<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>