dropWhileEnd is:exact

The dropWhileEnd function drops the largest suffix of a list in which the given predicate holds for all elements.

Laziness

This function is lazy in spine, but strict in elements, which makes it different from reverse . dropWhile p . reverse, which is strict in spine, but lazy in elements. For instance:
>>> take 1 (dropWhileEnd (< 0) (1 : undefined))
[1]
>>> take 1 (reverse $ dropWhile (< 0) $ reverse (1 : undefined))
*** Exception: Prelude.undefined
but on the other hand
>>> last (dropWhileEnd (< 0) [undefined, 1])
*** Exception: Prelude.undefined
>>> last (reverse $ dropWhile (< 0) $ reverse [undefined, 1])
1

Examples

>>> dropWhileEnd isSpace "foo\n"
"foo"
>>> dropWhileEnd isSpace "foo bar"
"foo bar"

>>> dropWhileEnd (> 10) [1..20]
[1,2,3,4,5,6,7,8,9,10]
Similar to dropWhileEnd, drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. dropWhileEnd p is equivalent to reverse . dropWhile p . reverse.
dropWhileEnd p xs returns the prefix remaining after takeWhileEnd p xs.
Similar to dropWhileEnd, drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. dropWhileEnd p is equivalent to reverse . dropWhile p . reverse.
>>> {-# LANGUAGE OverloadedLists #-)

>>> dropWhileEnd even [1,2,3,4,6]
[1,2,3]
Similar to dropWhileEnd, drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. dropWhileEnd p is equivalent to reverse . dropWhile p . reverse.
Similar to dropWhileEnd, drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. dropWhileEnd p is equivalent to reverse . dropWhile p . reverse.
O(n) dropWhileEnd p t returns the prefix remaining after dropping characters that satisfy the predicate p from the end of t. Examples:
>>> dropWhileEnd (=='.') "foo..."
"foo"
O(n) dropWhileEnd p t returns the prefix remaining after dropping characters that satisfy the predicate p from the end of t. Examples:
dropWhileEnd (=='.') "foo..." == "foo"
The dropWhileEnd function drops the largest suffix of a list in which the given predicate holds for all elements. For example:
>>> dropWhileEnd isSpace "foo\n"
"foo"
>>> dropWhileEnd isSpace "foo bar"
"foo bar"
dropWhileEnd isSpace ("foo\n" ++ undefined) == "foo" ++ undefined
O(n) dropWhileEnd p t returns the prefix remaining after dropping characters that satisfy the predicate p from the end of t. Subject to fusion. Examples:
>>> dropWhileEnd (=='.') "foo..."
"foo"
Remove longest suffix satisfying given predicate.
dropWhileEnd p t == fst (spanEnd p t)
>>> dropWhileEnd (>= 'c') "abcdabcd"
"abcdab"
O(n) dropWhileEnd p b returns the prefix remaining after dropping characters that satisfy the predicate p from the end of t.
Drops all elements from the end of the list that satisfy the function.
O(n) dropWhileEnd p t returns the prefix remaining after dropping characters that fail the predicate p from the end of t. Subject to fusion. Examples:
dropWhileEnd (=='.') "foo..." == "foo"
As dropWhile but drops from the end instead.
Similar to dropWhileEnd, drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. dropWhileEnd p is equivalent to reverse . dropWhile p . reverse.
Similar to dropWhileEnd, drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. dropWhileEnd p is equivalent to reverse . dropWhile p . reverse.
Similar to dropWhileEnd, drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. dropWhileEnd p is equivalent to reverse . dropWhile p . reverse.
Similar to dropWhileEnd, drops the longest (possibly empty) suffix of elements satisfying the predicate and returns the remainder. dropWhileEnd p is equivalent to reverse . dropWhile p . reverse.