Proposal #1464: add dropPrefix to Data.List

Isaac Dupree isaacdupree at
Sat Jun 30 06:50:28 EDT 2007

Hash: SHA1

Ian Lynagh wrote:
> I don't think I tend to want the extra generality of Conor's leftFactor,
> and no-one else has "me-too"ed it either. Also, writing "(_, ([], zs))"
> rather than "Just zs" would be a bit cumbersome, so I think I'd like
> dropPrefix even if we also had leftFactor.
> Thus, based on the feedback thus far, I think dropPrefix as defined
> above should go in, with 'generalising Data.List functions' and
> 'implementing "leftFactor"' being left to possible future proposals.

Agreed. I very well might use leftFactor, but... it is interesting...
hmm... too interesting to replace dropPrefix, I think... I really wish I
could try out leftFactor in something I'm already doing, to get a better
feel for it :)))

> On names, Stefan wrote "I'd name it differently---not sure how", as the
> existing drop* functions always returns a list. Other names I considered
> were stripPrefix and removePrefix, but I can't think of any commonality
> between those names and existing functions off the top of my head.

The name dropPrefix is somewhat redundant, since all existing "drop"
functions will only remove prefixes of a list anyway.  The other
connontation of "drop" is _wrong_ here: returning as much of the
original list as can't be dropped (as opposed to returning a Maybe).
Therefore, I see little or no merit in "drop" being part of the name,
assuming "Prefix" is.  I think I prefer stripPrefix.

Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


More information about the Libraries mailing list