<div dir="ltr">Likewise, I'm not in favor of name proliferation. To avoid confusion, I think it's sufficient to give a clear comments in the Haddocks explaining why one would wish to use this function.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 28, 2016 at 12:53 PM, Andreas Abel <span dir="ltr"><<a href="mailto:andreas.abel@ifi.lmu.de" target="_blank">andreas.abel@ifi.lmu.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+1 for "lookup".<span class=""><br>
<br>
On 28.06.2016 11:44, Oliver Charles wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
I don't really see the problem with lookup. To me, that function always<br>
takes a container, an index into that container, and returns the value<br>
under than index or fails. It just so happens that sets are indexed by<br>
the very values the contain, but I don't find the signature confusing.<br>
Sure, I might not use it very often, but it's still clear enough to me<br>
what it's doing.<br>
<br>
Ollie<br>
<br>
<br>
On Tue, 28 Jun 2016, 10:23 a.m. Chris Wong, <<a href="mailto:lambda.fairy@gmail.com" target="_blank">lambda.fairy@gmail.com</a><br></span><span class="">
<mailto:<a href="mailto:lambda.fairy@gmail.com" target="_blank">lambda.fairy@gmail.com</a>>> wrote:<br>
<br>
Python uses "intern", so perhaps that can serve as the name.<br>
<br>
(See <a href="https://docs.python.org/2/library/functions.html#intern" rel="noreferrer" target="_blank">https://docs.python.org/2/library/functions.html#intern</a>)<br>
<br>
On Tue, Jun 28, 2016 at 9:47 AM, David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a><br></span><span class="">
<mailto:<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>>> wrote:<br>
> +1 on the function. -1/2 on the name.<br>
><br>
> On Jun 27, 2016 5:45 PM, "Nicolas Godbout"<br></span>
<<a href="mailto:nicolas.godbout@gmail.com" target="_blank">nicolas.godbout@gmail.com</a> <mailto:<a href="mailto:nicolas.godbout@gmail.com" target="_blank">nicolas.godbout@gmail.com</a>>><div><div class="h5"><br>
> wrote:<br>
>><br>
>><br>
>> WHAT<br>
>><br>
>> It is proposed to add a ‘lookup' function on 'Set' in the<br>
"containers"<br>
>> package. Feedback during the next two weeks is welcome.<br>
>><br>
>> The function<br>
>><br>
>> > lookup :: Ord a => a -> Set a -> Maybe a<br>
>><br>
>> is almost indentical to the 'member' function but, in addition,<br>
returns<br>
>> the value<br>
>> stored in the set.<br>
>><br>
>> WHY<br>
>><br>
>> The point of this proposal is to facilitate program-wide data<br>
sharing. The<br>
>> 'lookup'<br>
>> function gives access to a pointer to an object already stored<br>
in a Set<br>
>> and equal<br>
>> to a given argument. The 'lookup' function is a natural<br>
extension to the<br>
>> current<br>
>> 'lookupLT', 'lookupGT', 'lookupLE' and 'lookupGE' functions,<br>
with obvious<br>
>> semantics.<br>
>><br>
>> Example use case: In a parser, the memory footprint can be<br>
reduced by<br>
>> collapsing<br>
>> all equal strings to a single instance of each string. To<br>
achieve this,<br>
>> one needs<br>
>> a way to get a previously seen string (internally, a pointer)<br>
equal to a<br>
>> newly<br>
>> parsed string. Amazingly, this is very difficult with the current<br>
>> "containers" library interface.<br>
>> One current option is to use a Map instead, e.g., 'Map String<br>
String'<br>
>> which stores twice as many pointers as necessary.<br>
>><br>
>> HOW<br>
>><br>
>> The git pull request at<br>
>> <a href="https://github.com/haskell/containers/pull/291" rel="noreferrer" target="_blank">https://github.com/haskell/containers/pull/291</a><br>
>> contains the straight-forward implementation of the 'lookup’<br>
function on<br>
>> 'Set', with test cases,<br>
>> as a patch against the current containers master branch.<br>
>><br>
>><br>
>> Salutations,<br>
>> Nicolas.<br>
>><br>
>> _______________________________________________<br>
>> Libraries mailing list<br></div></div>
>> <a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a> <mailto:<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a>><span class=""><br>
>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
><br>
><br>
> _______________________________________________<br>
> Libraries mailing list<br></span>
> <a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a> <mailto:<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a>><span class=""><br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
><br>
<br>
<br>
<br>
--<br>
Chris Wong (<a href="https://lambda.xyz" rel="noreferrer" target="_blank">https://lambda.xyz</a>)<br>
<br>
"I had not the vaguest idea what this meant and when I could not<br>
remember the words, my tutor threw the book at my head, which did not<br>
stimulate my intellect in any way." -- Bertrand Russell<br>
_______________________________________________<br>
Libraries mailing list<br></span>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a> <mailto:<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a>><span class=""><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br>
<br>
<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br>
</span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
<br>
-- <br>
Andreas Abel <>< Du bist der geliebte Mensch.<br>
<br>
Department of Computer Science and Engineering<br>
Chalmers and Gothenburg University, Sweden<br>
<br>
<a href="mailto:andreas.abel@gu.se" target="_blank">andreas.abel@gu.se</a><br>
<a href="http://www2.tcs.ifi.lmu.de/~abel/" rel="noreferrer" target="_blank">http://www2.tcs.ifi.lmu.de/~abel/</a></font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</div></div></blockquote></div><br></div>