Faster `elem` "Hack" for Data.Set?
Keith
keith.wygant at gmail.com
Sun Jan 30 14:30:53 UTC 2022
I haven't found a downside to requiring that the elements of sets be `Ord` to be `MonoFoldable`. Yes, the dictionary is ignored by all the generic methods, but you still needed it to construct the `Set`.
`MonoFoldable` includes some questionable design choices, but the `Ord` requirement for `Set` is not one.
Sent from my phone with K-9 Mail.
On 30 January 2022 05:19:46 UTC, David Feuer <david.feuer at gmail.com> wrote:
>MonoFoldable isn't the answer either. That also has the problem of
>requiring the same constraint for folding as for membership tests.
>
>On Sun, Jan 30, 2022, 12:12 AM PHO <pho at cielonegro.org> wrote:
>
>> On 1/30/22 9:59 AM, David Feuer wrote:
>> [snip]
>> > . I think the real answer is to remove `elem` from `Foldable` and put
>> > it somewhere more appropriate.
>>
>> In a separate class? That would only help `elem` but not any other
>> methods of Foldable. I'd rather love to see MonoFoldable[1] to be moved
>> to base then.
>>
>> [1]:
>>
>> https://hackage.haskell.org/package/mono-traversable-1.0.15.3/docs/Data-MonoTraversable.html#t:MonoFoldable
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20220130/a97853f6/attachment.html>
More information about the Libraries
mailing list