Function to add to Data.List

Andreas Abel andreas.abel at ifi.lmu.de
Sun Apr 6 08:33:29 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06.04.2014 10:09, Herbert Valerio Riedel wrote:
> On 2014-04-06 at 00:33:34 +0200, Henning Thielemann wrote:
>> Am 06.04.2014 00:27, schrieb Niklas Haas:
>>> This already exists in the form of
>>> 
>>> sortBy . comparing
>> 
>> Not exactly, because sortByKey memorizes the results of 'f' and 
>> (sortBy . comparing) recomputes 'f' all the time.
> 
> ...what about a RULE that replaces "sortBy . comparing" by an
> internal non-exported "sortByKey"?

How does GHC give evidence to the programmer that RULEs actually
applied?  How do you argue to the user of Data.List that there is no
need to implement a (memoizing) sortByKey since GHC will do the right
thing for him if he uses sortBy . comparing instead?

As long as RULEs remain some (practically) invisible compiler magic,
as long as I have a way to declare that in certain situations certain
rules absolutely MUST fire, I can put no trust in the whole RULEs
mechanism.

Cheers,
Andreas

- -- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Department of Computer Science and Engineering
Chalmers and Gothenburg University, Sweden

andreas.abel at gu.se
http://www2.tcs.ifi.lmu.de/~abel/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlNBEVkACgkQPMHaDxpUpLPaIgCg1SuQLD9lHoVrGpgIcFipQ/9Q
7MUAn2C5w2/wgpvyGoJOEjg7hMeLNVrk
=zunq
-----END PGP SIGNATURE-----


More information about the Libraries mailing list