MonadPlus m => (b -> Bool) -> m b -> m b

mfilter :: MonadPlus m => (a -> Bool) -> m a -> m a
base Control.Monad
Direct MonadPlus equivalent of filter filter = (mfilter:: (a -> Bool) -> [a] -> [a] applicable to any MonadPlus, for example mfilter odd (Just 1) == Just 1 mfilter odd (Just 2) == Nothing
filter :: (a -> Bool) -> IntMap a -> IntMap a
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). Filter all values that satisfy some predicate. > filter (> "a") (fromList [(5,"a"), (3,"b")]) == singleton 3 "b" > filter (> "x") (fromList [(5,"a"), (3,"b")]) == empty > filter (< "a") (fromList [(5,"a"), (3,"b")]) == empty
dropWhileL :: (a -> Bool) -> Seq a -> Seq a
containers Data.Sequence
O(i) p xs</tt> returns the suffix remaining after takeWhileL p xs.
dropWhileR :: (a -> Bool) -> Seq a -> Seq a
containers Data.Sequence
O(i) p xs</tt> returns the prefix remaining after takeWhileR p xs. dropWhileR p xs is equivalent to reverse (dropWhileL p (reverse xs)).
filter :: (a -> Bool) -> Seq a -> Seq a
containers Data.Sequence
O(n). The filter function takes a predicate p and a sequence xs and returns a sequence of those elements which satisfy the predicate.
takeWhileL :: (a -> Bool) -> Seq a -> Seq a
containers Data.Sequence
O(i) applied to a predicate p and a sequence xs, returns the longest prefix (possibly empty) of xs of elements that satisfy p.
takeWhileR :: (a -> Bool) -> Seq a -> Seq a
containers Data.Sequence
O(i) applied to a predicate p and a sequence xs, returns the longest suffix (possibly empty) of xs of elements that satisfy p. takeWhileR p xs is equivalent to reverse (takeWhileL p (reverse xs)).
filter :: (a -> Bool) -> Set a -> Set a
containers Data.Set
O(n). Filter all elements that satisfy the predicate.
dropWhile :: (a -> Bool) -> [a] -> [a]
base Prelude, base Data.List
dropWhile p xs returns the suffix remaining after takeWhile p xs: > dropWhile (< 3) [1,2,3,4,5,1,2,3] == [3,4,5,1,2,3] > dropWhile (< 9) [1,2,3] == [] > dropWhile (< 0) [1,2,3] == [1,2,3]
filter :: (a -> Bool) -> [a] -> [a]
base Prelude, base Data.List
filter, applied to a predicate and a list, returns the list of those elements that satisfy the predicate; i.e., > filter p xs = [ x | x <- xs, p x]
takeWhile :: (a -> Bool) -> [a] -> [a]
base Prelude, base Data.List
takeWhile, applied to a predicate p and a list xs, returns the longest prefix (possibly empty) of xs of elements that satisfy p: > takeWhile (< 3) [1,2,3,4,1,2,3,4] == [1,2] > takeWhile (< 9) [1,2,3] == [1,2,3] > takeWhile (< 0) [1,2,3] == []
suchThat :: Gen a -> (a -> Bool) -> Gen a
QuickCheck Test.QuickCheck.Gen, QuickCheck Test.QuickCheck
Generates a value that satisfies a predicate.
condB :: (a -> Bool) -> BoundedPrim a -> BoundedPrim a -> BoundedPrim a
bytestring Data.ByteString.Builder.Prim
Conditionally select a BoundedPrim. For example, we can implement the ASCII primitive that drops characters with Unicode codepoints above 127 as follows. > charASCIIDrop = condB (< '\128') (fromF char7) emptyB
find :: Foldable t => (a -> Bool) -> t a -> Maybe a
base Data.Foldable
The find function takes a predicate and a structure and returns the leftmost element of the structure matching the predicate, or Nothing if there is no such element.
throwIf :: (a -> Bool) -> (a -> String) -> IO a -> IO a
base Foreign.Marshal.Error
Execute an IO action, throwing a userError if the predicate yields True when applied to the result returned by the IO action. If no exception is raised, return the result of the computation.
throwErrnoIf :: (a -> Bool) -> String -> IO a -> IO a
base Foreign.C.Error
Throw an IOError corresponding to the current value of getErrno if the result value of the IO action meets the given predicate.
throwErrnoIfRetry :: (a -> Bool) -> String -> IO a -> IO a
base Foreign.C.Error
as throwErrnoIf, but retry the IO action when it yields the error code eINTR - this amounts to the standard retry loop for interrupted POSIX system calls.
findIndices :: (a -> Bool) -> [a] -> [Int]
base Data.List
The findIndices function extends findIndex, by returning the indices of all elements satisfying the predicate, in ascending order.
escapeURIString :: (Char -> Bool) -> String -> String
network Network.URI
Can be used to make a string valid for use in a URI.
throwErrnoIfRetryMayBlock :: (a -> Bool) -> String -> IO a -> IO b -> IO a
base Foreign.C.Error
as throwErrnoIfRetry, but additionally if the operation yields the error code eAGAIN or eWOULDBLOCK, an alternative action is executed before retrying.

Show more results