Proposal: adding 'tailDropWhile' to Data.List

Roman Leshchinskiy rl at cse.unsw.edu.au
Wed Sep 28 23:53:37 CEST 2011


On 28/09/2011, at 17:11, Evan Laforge wrote:

> I don't think that's a realistic attitude at the moment.
> tailDropWhile was one of the first things I put in my personal
> library, along with various string functions like strip, split, and
> join, and I still use them all the time on strings.  Certainly the
> performance sensitive parts of code use ByteString or Text, but the
> vast majority of strings are not in critical sections or are quite
> small and using Text everywhere would be awkward syntactically for no
> measurable gain.  Also a lot of libraries only accept and produce
> Strings.

If performance isn't a concern, what's wrong with using reverse . dropWhile f . reverse? Another easy definition is this:

  foldr (\x xs -> if null xs && f x then [] else x:xs) []

Roman





More information about the Libraries mailing list