Safe Haskell | Safe-Inferred |
---|---|

Language | Haskell98 |

- all :: Foldable t => (a -> Bool) -> t a -> Bool
- and :: Foldable t => t Bool -> Bool
- any :: Foldable t => (a -> Bool) -> t a -> Bool
- concat :: Foldable t => t [a] -> [a]
- concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
- elem :: (Foldable t, Eq a) => a -> t a -> Bool
- find :: Foldable t => (a -> Bool) -> t a -> Maybe a
- foldl :: Foldable t => forall b a. (b -> a -> b) -> b -> t a -> b
- foldl' :: Foldable t => forall b a. (b -> a -> b) -> b -> t a -> b
- foldl1 :: Foldable t => forall a. (a -> a -> a) -> t a -> a
- foldr :: Foldable t => forall a b. (a -> b -> b) -> b -> t a -> b
- foldr1 :: Foldable t => forall a. (a -> a -> a) -> t a -> a
- length :: Foldable t => t a -> Int
- maximum :: (Foldable t, Ord a) => t a -> a
- maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- minimum :: (Foldable t, Ord a) => t a -> a
- minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
- notElem :: (Foldable t, Eq a) => a -> t a -> Bool
- null :: Foldable t => t a -> Bool
- or :: Foldable t => t Bool -> Bool
- product :: (Foldable t, Num a) => t a -> a
- sum :: (Foldable t, Num a) => t a -> a
- mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
- mapAccumR :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
- isSubsequenceOf :: Eq a => [a] -> [a] -> Bool
- sortOn :: Ord b => (a -> b) -> [a] -> [a]
- uncons :: [a] -> Maybe (a, [a])
- scanl' :: (b -> a -> b) -> b -> [a] -> [b]

# Documentation

all :: Foldable t => (a -> Bool) -> t a -> Bool

Determines whether all elements of the structure satisfy the predicate.

any :: Foldable t => (a -> Bool) -> t a -> Bool

Determines whether any element of the structure satisfies the predicate.

concatMap :: Foldable t => (a -> [b]) -> t a -> [b]

Map a function over all the elements of a container and concatenate the resulting lists.

length :: Foldable t => t a -> Int Source

Returns the size/length of a finite structure as an `Int`

. The
default implementation is optimized for structures that are similar to
cons-lists, because there is no general way to do better.

maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a

The largest element of a non-empty structure with respect to the given comparison function.

minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a

The least element of a non-empty structure with respect to the given comparison function.

null :: Foldable t => t a -> Bool Source

Test whether the structure is empty. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.

product :: (Foldable t, Num a) => t a -> a

The `product`

function computes the product of the numbers of a structure.

sum :: (Foldable t, Num a) => t a -> a

The `sum`

function computes the sum of the numbers of a structure.

mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)

mapAccumR :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)

isSubsequenceOf :: Eq a => [a] -> [a] -> Bool Source

The `isSubsequenceOf`

function takes two lists and returns `True`

if the
first list is a subsequence of the second list.

is equivalent to `isSubsequenceOf`

x y

.`elem`

x (`subsequences`

y)

*Since: 4.8.0.0*

**Examples**

`>>>`

True`isSubsequenceOf "GHC" "The Glorious Haskell Compiler"`

`>>>`

True`isSubsequenceOf ['a','d'..'z'] ['a'..'z']`

`>>>`

False`isSubsequenceOf [1..10] [10,9..0]`

sortOn :: Ord b => (a -> b) -> [a] -> [a] Source

Sort a list by comparing the results of a key function applied to each
element. `sortOn f`

is equivalent to `sortBy . comparing f`

, but has the
performance advantage of only evaluating `f`

once for each element in the
input list. This is called the decorate-sort-undecorate paradigm, or
Schwartzian transform.

*Since: 4.8.0.0*