<html><head></head><body>I usually end up writing your 'lurkup' when I use maps, so I'd like see it included.<br><br> I don't have a better name than 'lookupWith'.<br><br>And, yeah, lookupDefault has not been useful in practice.<br>—<br>Sent from my phone with K-9 Mail.<br><br><div class="gmail_quote">On June 8, 2020 7:07:13 PM UTC, David Feuer <david.feuer@gmail.com> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="auto">Discussion has gotten going again about harmonizing between the names findWithDefault and lookupDefault in containers and unordered-containers:<div dir="auto"><br></div><div dir="auto">    findWithDefault :: Ord k</div><div dir="auto">      => a -> k -> Map k a -> a</div><div dir="auto">    lookupDefault :: (Eq k, Hashable k)</div><div dir="auto">      => a -> k -> HashMap k a -> a</div><div dir="auto"><br></div><div dir="auto">I've been fairly unenthusiastic about adding extra names for this function in one package or the other, in large part because I don't like the function. I'd much rather have something in the spirit of `either`, `maybe`, `bool`, etc.:</div><div dir="auto"><br></div><div dir="auto">    lurkup :: Ord k</div><div dir="auto">       => r -> (a -> r) -> k -> Map k a -> r</div><div dir="auto">    lurkup r f k = maybe r f . lookup k</div><div dir="auto">    lookup k = lurkup Nothing Just k</div><div dir="auto"><br></div><div dir="auto">Unfortunately, I haven't been able to come up with a decent name for this function. Can anyone help?</div></div>
</blockquote></div></body></html>