all

Determines whether all elements of the structure satisfy the predicate.

Examples

Basic usage:
>>> all (> 3) []
True
>>> all (> 3) [1,2]
False
>>> all (> 3) [1,2,3,4,5]
False
>>> all (> 3) [1..]
False
>>> all (> 3) [4..]
* Hangs forever *
Applied to a predicate and a list, all determines if all elements of the list satisfy the predicate. For the result to be True, the list must be finite; False, however, results from a False value for the predicate applied to an element at a finite index of a finite or infinite list.
>>> all (> 3) []
True

>>> all (> 3) [1,2]
False

>>> all (> 3) [1,2,3,4,5]
False

>>> all (> 3) [1..]
False

>>> all (> 3) [4..]
* Hangs forever *
O(n) Applied to a predicate and a ByteString, all determines if all elements of the ByteString satisfy the predicate.
Applied to a predicate and a ByteString, all determines if all elements of the ByteString satisfy the predicate.
O(n) Applied to a predicate and a ShortByteString, all determines if all elements of the ShortByteString satisfy the predicate.
O(n) all p t determines whether all characters in the Text t satisfy the predicate p.
O(n) all p xs determines if all characters in the Text xs satisfy the predicate p. Properties
all f . stream = all f
O(n) Applied to a predicate and a ShortByteString, all determines if all elements of the ShortByteString satisfy the predicate.
O(n) Check if all elements satisfy the predicate.

Examples

>>> import qualified Data.Vector as V

>>> V.all even $ V.fromList [2, 4, 12]
True

>>> V.all even $ V.fromList [2, 4, 13]
False

>>> V.all even (V.empty :: V.Vector Int)
True
O(n) Check if all elements satisfy the predicate.

Examples

>>> import qualified Data.Vector as V

>>> V.all even $ V.fromList [2, 4, 12]
True

>>> V.all even $ V.fromList [2, 4, 13]
False

>>> V.all even (V.empty :: V.Vector Int)
True
O(n) Check if all elements satisfy the predicate.

Examples

>>> import qualified Data.Vector.Primitive as VP

>>> VP.all even $ VP.fromList [2, 4, 12 :: Int]
True

>>> VP.all even $ VP.fromList [2, 4, 13 :: Int]
False

>>> VP.all even (VP.empty :: VP.Vector Int)
True
O(n) Check if all elements satisfy the predicate.

Examples

>>> import qualified Data.Vector.Storable as VS

>>> VS.all even $ VS.fromList [2, 4, 12 :: Int]
True

>>> VS.all even $ VS.fromList [2, 4, 13 :: Int]
False

>>> VS.all even (VS.empty :: VS.Vector Int)
True
O(n) Check if all elements satisfy the predicate.

Examples

>>> import qualified Data.Vector.Unboxed as VU

>>> VU.all even $ VU.fromList [2, 4, 12 :: Int]
True

>>> VU.all even $ VU.fromList [2, 4, 13 :: Int]
False

>>> VU.all even (VU.empty :: VU.Vector Int)
True
Verifies that a predicate holds for all elements of an array.
Check that all values in the stream return True. Subject to shortcut logic: at the first False, consumption of the stream will stop. Subject to fusion
Check if all elements of a byte array satisfy a predicate
(all predicate p) determines whether all the elements of p satisfy the predicate.
(all predicate) returns True if all elements satisfy the predicate, False otherwise
(all predicate) returns True if all bytes satisfy the predicate, False otherwise
(all predicate) returns True if all characters satisfy the predicate, False otherwise
all predicate stream returns True if every element in stream matches the predicate. all consumes as few elements as possible, ending consumption if any element fails the predicate.
ghci> is <- Streams.fromList [1, 2, 3]
ghci> Streams.all (< 0) is    -- Consumes one element
False
ghci> Streams.read is
Just 2
ghci> Streams.all odd is      -- Only 3 remains
True
Determines whether all elements of the structure satisfy the predicate.
O(n) all p t determines whether all characters in the Text t satisfy the predicate p. Subject to fusion.
O(n) Check if all elements satisfy the predicate.

Examples

>>> import qualified Data.Vector as V

>>> V.all even $ V.fromList [2, 4, 12 :: Int]
True

>>> V.all even $ V.fromList [2, 4, 13 :: Int]
False

>>> V.all even (V.empty :: V.Vector Int)
True