Data.List.Reverse.StrictSpine

utility-ht-0.0.12: Various small helper functions for Lists, Maybes, Tuples, Functions

Safe Haskell | Safe
Language | Haskell98

Data.List.Reverse.StrictSpine

Description

The functions in this module process the list from the end. They do not access elements at the beginning if not necessary. You can apply the function only to infinite lists. Use these functions if the list is short and the test is expensive.

Synopsis

- dropWhile :: (a -> Bool) -> [a] -> [a]
- takeWhile :: (a -> Bool) -> [a] -> [a]
- span :: (a -> Bool) -> [a] -> ([a], [a])

# Documentation

dropWhile :: (a -> Bool) -> [a] -> [a] #

Like `reverse . List.dropWhile p . reverse`.

takeWhile :: (a -> Bool) -> [a] -> [a] #

Like `reverse . List.takeWhile p . reverse`.

span :: (a -> Bool) -> [a] -> ([a], [a]) #

    span p xs == (dropWhile p xs, takeWhile p xs)