@@ -115,6 +115,9 @@ module Data.Array
115115 , zip
116116 , unzip
117117
118+ , any
119+ , all
120+
118121 , foldM
119122 , foldRecM
120123
@@ -134,7 +137,7 @@ import Data.Array.NonEmpty.Internal (NonEmptyArray(..))
134137import Data.Array.ST as STA
135138import Data.Array.ST.Iterator as STAI
136139import Data.Foldable (class Foldable , foldl , foldr , traverse_ )
137- import Data.Foldable (foldl , foldr , foldMap , fold , intercalate , any , all ) as Exports
140+ import Data.Foldable (foldl , foldr , foldMap , fold , intercalate ) as Exports
138141import Data.Maybe (Maybe (..), maybe , isJust , fromJust , isNothing )
139142import Data.Traversable (sequence , traverse )
140143import Data.Tuple (Tuple (..), fst , snd )
@@ -1035,7 +1038,7 @@ nubByEq :: forall a. (a -> a -> Boolean) -> Array a -> Array a
10351038nubByEq eq xs = ST .run do
10361039 arr <- STA .empty
10371040 ST .foreach xs \x -> do
1038- e <- not <<< Exports . any (_ `eq` x) <$> (STA .unsafeFreeze arr)
1041+ e <- not <<< any (_ `eq` x) <$> (STA .unsafeFreeze arr)
10391042 when e $ void $ STA .push x arr
10401043 STA .unsafeFreeze arr
10411044
@@ -1192,6 +1195,12 @@ unzip xs =
11921195 snds' <- STA .unsafeFreeze snds
11931196 pure $ Tuple fsts' snds'
11941197
1198+ -- | Returns true if at least one array element satisfy the given predicate.
1199+ foreign import any :: forall a . (a -> Boolean ) -> Array a -> Boolean
1200+
1201+ -- | Returns true if all the array elements satisfy the given predicate.
1202+ foreign import all :: forall a . (a -> Boolean ) -> Array a -> Boolean
1203+
11951204-- | Perform a fold using a monadic step function.
11961205-- |
11971206-- | ```purescript
0 commit comments