Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Data/Array.purs
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,10 @@ groupBy :: forall a. (a -> a -> Boolean) -> Array a -> Array (Array a)
groupBy op = go []
where
go :: Array (Array a) -> Array a -> Array (Array a)
go acc [] = reverse acc
go acc xs = case uncons xs of
Just o -> let sp = span (op o.head) o.tail
in go ((o.head : sp.init) : acc) sp.rest
Just o -> let sp = span (op o.head) o.tail
in go ((o.head : sp.init) : acc) sp.rest
Nothing -> reverse acc

--------------------------------------------------------------------------------
-- Set-like operations ---------------------------------------------------------
Expand All @@ -474,9 +474,9 @@ nub = nubBy eq
-- | Remove the duplicates from an array, where element equality is determined
-- | by the specified equivalence relation, creating a new array.
nubBy :: forall a. (a -> a -> Boolean) -> Array a -> Array a
nubBy _ [] = []
nubBy eq xs = case uncons xs of
Just o -> o.head : nubBy eq (filter (\y -> not (o.head `eq` y)) o.tail)
Nothing -> []

-- | Calculate the union of two lists.
-- |
Expand Down