Skip to content

Commit 0871480

Browse files
committed
Use <<< instead of >>>
1 parent 83991e4 commit 0871480

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/Data/List.purs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -686,17 +686,17 @@ nub = nubBy compare
686686
-- | Running time: `O(n log n)`
687687
nubBy :: forall a. (a -> a -> Ordering) -> List a -> List a
688688
nubBy p =
689-
-- Add indices so we can recover original order after deduplicating.
690-
addIndexReverse
691-
-- Sort by original values to cluster duplicates.
692-
>>> sortBy (p `on` snd)
693-
-- Removing neighboring duplicates.
694-
>>> nubByAdjacentReverse (\a b -> (p `on` snd) a b == EQ)
689+
-- Discard indices, just keep original values.
690+
mapReverse snd
695691
-- Sort by index to recover original order.
696692
-- Use `flip` to sort in reverse order in anticipation of final `mapReverse`.
697-
>>> sortBy (flip compare `on` fst)
698-
-- Discard indices, just keep original values.
699-
>>> mapReverse snd
693+
<<< sortBy (flip compare `on` fst)
694+
-- Removing neighboring duplicates.
695+
<<< nubByAdjacentReverse (\a b -> (p `on` snd) a b == EQ)
696+
-- Sort by original values to cluster duplicates.
697+
<<< sortBy (p `on` snd)
698+
-- Add indices so we can recover original order after deduplicating.
699+
<<< addIndexReverse
700700

701701
-- | Remove duplicate elements from a list.
702702
-- | Keeps the first occurrence of each element in the input list,
@@ -871,7 +871,7 @@ mapReverse f = go Nil
871871
-- | Equivalent to:
872872
-- |
873873
-- | ```purescript
874-
-- | mapWithIndex Tuple >>> reverse
874+
-- | reverse <<< mapWithIndex Tuple
875875
-- | ```
876876
-- |
877877
-- | Running time: `O(n)`

0 commit comments

Comments
 (0)