Proposal: Add `restriction` to Data.Map and Data.IntMap

Joachim Breitner mail at joachim-breitner.de
Mon Jul 25 22:05:14 UTC 2016


Hi,

Am Montag, den 25.07.2016, 14:59 -0400 schrieb David Feuer:
> Both `restrictKeys` and `withoutKeys` are special cases of
> `filterWithKey` (although they should be considerably more efficient
> than implementations using that function).

I’m risking to derailing this discussion, but how viable would it be to
*not* add a new exported name for this, but recommend (e.g. in the
docs) to use

    filter (`S.elem` set) map

and then rely on rewrite rules to get the desired performance effect
(by rewriting this expression to an non-exported restrictKeys)?

I guess the answer is: Not viable enough, because rewrite rules are not
applied reliably enough, and because you cannot easily have the effect
of a partial "map `restrictKeys`". But nevertheless it is an
interesting idea to imagine a programming language where APIs can be
minimal, modular and composable without performance penalties.

Greetings,
Joachim




-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttps://www.joachim-breitner.de/
  XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160726/a679d9f9/attachment-0001.sig>


More information about the Libraries mailing list