@@ -94,10 +94,6 @@ import Data.Traversable (sequence)
9494import Data.Tuple (Tuple (..))
9595import qualified Data.Maybe.Unsafe as U
9696
97- -- ------------------------------------------------------------------------------
98- -- Array creation --------------------------------------------------------------
99- -- ------------------------------------------------------------------------------
100-
10197-- | Create an array of one element
10298singleton :: forall a . a -> Array a
10399singleton a = [a]
@@ -464,10 +460,6 @@ groupBy op = go []
464460 in go ((o.head : sp.init) : acc) sp.rest
465461 Nothing -> reverse acc
466462
467- -- ------------------------------------------------------------------------------
468- -- Set-like operations ---------------------------------------------------------
469- -- ------------------------------------------------------------------------------
470-
471463-- | Remove the duplicates from an array, creating a new array.
472464nub :: forall a . (Eq a ) => Array a -> Array a
473465nub = nubBy eq
@@ -519,10 +511,6 @@ intersect = intersectBy eq
519511intersectBy :: forall a . (a -> a -> Boolean ) -> Array a -> Array a -> Array a
520512intersectBy eq xs ys = filter (\x -> isJust (findIndex (eq x) ys)) xs
521513
522- -- ------------------------------------------------------------------------------
523- -- Zipping ---------------------------------------------------------------------
524- -- ------------------------------------------------------------------------------
525-
526514-- | Apply a function to pairs of elements at the same index in two arrays,
527515-- | collecting the results in a new array.
528516-- |
@@ -551,10 +539,6 @@ unzip :: forall a b. Array (Tuple a b) -> Tuple (Array a) (Array b)
551539unzip = uncons' (\_ -> Tuple [] [] ) \(Tuple a b) ts -> case unzip ts of
552540 Tuple as bs -> Tuple (a : as) (b : bs)
553541
554- -- ------------------------------------------------------------------------------
555- -- Folding ---------------------------------------------------------------------
556- -- ------------------------------------------------------------------------------
557-
558542-- | Perform a fold using a monadic step function.
559543foldM :: forall m a b . (Monad m ) => (a -> b -> m a ) -> a -> Array b -> m a
560544foldM f a = uncons' (\_ -> return a) (\b bs -> f a b >>= \a' -> foldM f a' bs)
0 commit comments