
Hi, Am Mittwoch, den 23.02.2011, 20:06 -0500 schrieb wren ng thornton:
On 2/23/11 4:42 PM, Sterling Clover wrote:
A quick grep of some of my own source reveals that I've used M.size and S.size only to test for sizes equal to 1. So, for my purposes at least, an O(1) isSingleton operation would be just as useful as an O(1) size.
I agree, a fast isSingleton function would cover a very common use case--- especially for set-like containers.
would ghc’s rule system be strong enough to replace "size m == 1" by "isSingleton m"? It would be nice if programmers get the advantage even when they did not notice that a isSingleton function is provided. Greetings, Joachim -- Joachim "nomeata" Breitner mail: mail@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C JID: nomeata@joachim-breitner.de | http://www.joachim-breitner.de/ Debian Developer: nomeata@debian.org