[Haskell-cafe] stripSuffix

Evan Laforge qdunkan at gmail.com
Wed Jul 18 09:39:34 CEST 2012

>> I can think of two cases where I'd want something like this.
>> One is manipulating file extensions, where I'd want to use
>> System.FilePath.splitExtension or something like that anyway.
>> The other is suffix stripping for text processing, where I'd
>> want to use a trie to match a whole lot of possible suffixes.
> For what it's worth, there are a lot of other cases (outside of file
> path handling) in which I've found it useful.

I also have 'rdrop' and 'rdropWhile' and 'rstrip' in my stdlib, and
use them regularly, if not frequently, along with List.isSuffixOf.

Yes, they're inefficient for long lists and hang on infinite ones, but
there are still lots of short lists out there.

More information about the Haskell-Cafe mailing list