<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>Could you share why you are more enthusiastic about such a function?</div><div><br></div><div>On Mon, 8 Jun 2020, at 8:07 PM, David Feuer wrote:<br></div><blockquote type="cite" id="qt" style=""><div dir="auto"><div>Discussion has gotten going again about harmonizing between the names findWithDefault and lookupDefault in containers and unordered-containers:<br></div><div dir="auto"><br></div><div dir="auto">    findWithDefault :: Ord k<br></div><div dir="auto">      => a -> k -> Map k a -> a<br></div><div dir="auto">    lookupDefault :: (Eq k, Hashable k)<br></div><div dir="auto">      => a -> k -> HashMap k a -> a<br></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.:<br></div><div dir="auto"><br></div><div dir="auto">    lurkup :: Ord k<br></div><div dir="auto">       => r -> (a -> r) -> k -> Map k a -> r<br></div><div dir="auto">    lurkup r f k = maybe r f . lookup k<br></div><div dir="auto">    lookup k = lurkup Nothing Just k<br></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?<br></div></div><div>_______________________________________________<br></div><div>Libraries mailing list<br></div><div><a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br></div><div><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br></div><div><br></div></blockquote></body></html>