From fe770b87f1bd8e9f7971e6088371ab3cbc20dd1d Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Thu, 17 Mar 2022 08:49:57 -0500 Subject: [PATCH 1/4] Drop deprecated things --- src/Data/List.purs | 13 ------------- src/Data/List/NonEmpty.purs | 11 ----------- 2 files changed, 24 deletions(-) diff --git a/src/Data/List.purs b/src/Data/List.purs index db9c1cd..c8c09a5 100644 --- a/src/Data/List.purs +++ b/src/Data/List.purs @@ -51,7 +51,6 @@ module Data.List , filterM , mapMaybe , catMaybes - , mapWithIndex , sort , sortBy @@ -68,7 +67,6 @@ module Data.List , span , group , groupAll - , group' , groupBy , groupAllBy , partition @@ -429,13 +427,6 @@ mapMaybe f = go Nil catMaybes :: forall a. List (Maybe a) -> List a catMaybes = mapMaybe identity - --- | Apply a function to each element and its index in a list starting at 0. --- | --- | Deprecated. Use Data.FunctorWithIndex instead. -mapWithIndex :: forall a b. (Int -> a -> b) -> List a -> List b -mapWithIndex = FWI.mapWithIndex - -------------------------------------------------------------------------------- -- Sorting --------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -606,10 +597,6 @@ group = groupBy (==) groupAll :: forall a. Ord a => List a -> List (NEL.NonEmptyList a) groupAll = group <<< sort --- | Deprecated previous name of `groupAll`. -group' :: forall a. Warn (Text "'group\'' is deprecated, use groupAll instead") => Ord a => List a -> List (NEL.NonEmptyList a) -group' = groupAll - -- | Group equal, consecutive elements of a list into lists, using the specified -- | equivalence relation to determine equality. -- | diff --git a/src/Data/List/NonEmpty.purs b/src/Data/List/NonEmpty.purs index 01c3db7..0e1f541 100644 --- a/src/Data/List/NonEmpty.purs +++ b/src/Data/List/NonEmpty.purs @@ -32,7 +32,6 @@ module Data.List.NonEmpty , mapMaybe , catMaybes , appendFoldable - , mapWithIndex , sort , sortBy , take @@ -42,7 +41,6 @@ module Data.List.NonEmpty , span , group , groupAll - , group' , groupBy , groupAllBy , partition @@ -235,12 +233,6 @@ appendFoldable :: forall t a. Foldable t => NonEmptyList a -> t a -> NonEmptyLis appendFoldable (NonEmptyList (x :| xs)) ys = NonEmptyList (x :| (xs <> L.fromFoldable ys)) --- | Apply a function to each element and its index in a list starting at 0. --- | --- | Deprecated. Use Data.FunctorWithIndex instead. -mapWithIndex :: forall a b. (Int -> a -> b) -> NonEmptyList a -> NonEmptyList b -mapWithIndex = FWI.mapWithIndex - sort :: forall a. Ord a => NonEmptyList a -> NonEmptyList a sort xs = sortBy compare xs @@ -268,9 +260,6 @@ group = wrappedOperation "group" L.group groupAll :: forall a. Ord a => NonEmptyList a -> NonEmptyList (NonEmptyList a) groupAll = wrappedOperation "groupAll" L.groupAll -group' :: forall a. Warn (Text "'group\'' is deprecated, use groupAll instead") => Ord a => NonEmptyList a -> NonEmptyList (NonEmptyList a) -group' = groupAll - groupBy :: forall a. (a -> a -> Boolean) -> NonEmptyList a -> NonEmptyList (NonEmptyList a) groupBy = wrappedOperation "groupBy" <<< L.groupBy From ec0837e8e4af41484d685c05041177ebf193fecd Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Thu, 17 Mar 2022 08:50:23 -0500 Subject: [PATCH 2/4] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc43e60..a3c961b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based Breaking changes: - Update project and deps to PureScript v0.15.0 (#203 by @JordanMartinez) - Drop deprecated `MonadZero` instance (#205 by @JordanMartinez) +- Drop deprecated `group'` and `mapWithIndex` (#206 by @JordanMartinez) New features: From 9d63dda4108a490eb26cddb8410a70f26ef2766c Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Thu, 17 Mar 2022 09:10:20 -0500 Subject: [PATCH 3/4] Drop redundant imports --- src/Data/List.purs | 1 - src/Data/List/NonEmpty.purs | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/Data/List.purs b/src/Data/List.purs index c8c09a5..a8df8c7 100644 --- a/src/Data/List.purs +++ b/src/Data/List.purs @@ -115,7 +115,6 @@ import Data.Traversable (scanl, scanr) as Exports import Data.Traversable (sequence) import Data.Tuple (Tuple(..)) import Data.Unfoldable (class Unfoldable, unfoldr) -import Prim.TypeError (class Warn, Text) -- | Convert a list into any unfoldable structure. -- | diff --git a/src/Data/List/NonEmpty.purs b/src/Data/List/NonEmpty.purs index 0e1f541..4afa6f5 100644 --- a/src/Data/List/NonEmpty.purs +++ b/src/Data/List/NonEmpty.purs @@ -80,8 +80,6 @@ import Data.Semigroup.Foldable (fold1, foldMap1, for1_, sequence1_, traverse1_) import Data.Semigroup.Traversable (sequence1, traverse1, traverse1Default) as Exports import Data.Traversable (scanl, scanr) as Exports -import Prim.TypeError (class Warn, Text) - -- | Internal function: any operation on a list that is guaranteed not to delete -- | all elements also applies to a NEL, this function is a helper for defining -- | those cases. From 3d839c95986d297b945ef9cf8759e0312c443248 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Thu, 17 Mar 2022 09:12:59 -0500 Subject: [PATCH 4/4] Fix imports --- src/Data/List.purs | 1 - src/Data/List/NonEmpty.purs | 1 - test/Test/Data/List.purs | 5 +---- test/Test/Data/List/NonEmpty.purs | 3 --- 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Data/List.purs b/src/Data/List.purs index a8df8c7..fc99156 100644 --- a/src/Data/List.purs +++ b/src/Data/List.purs @@ -104,7 +104,6 @@ import Control.Monad.Rec.Class (class MonadRec, Step(..), tailRecM, tailRecM2) import Data.Bifunctor (bimap) import Data.Foldable (class Foldable, foldr, any, foldl) import Data.Foldable (foldl, foldr, foldMap, fold, intercalate, elem, notElem, find, findMap, any, all) as Exports -import Data.FunctorWithIndex (mapWithIndex) as FWI import Data.List.Internal (emptySet, insertAndLookupBy) import Data.List.Types (List(..), (:)) import Data.List.Types (NonEmptyList(..)) as NEL diff --git a/src/Data/List/NonEmpty.purs b/src/Data/List/NonEmpty.purs index 4afa6f5..ffb72ea 100644 --- a/src/Data/List/NonEmpty.purs +++ b/src/Data/List/NonEmpty.purs @@ -63,7 +63,6 @@ module Data.List.NonEmpty import Prelude import Data.Foldable (class Foldable) -import Data.FunctorWithIndex (mapWithIndex) as FWI import Data.List ((:)) import Data.List as L import Data.List.Types (NonEmptyList(..)) diff --git a/test/Test/Data/List.purs b/test/Test/Data/List.purs index 5ac2db8..d94450b 100644 --- a/test/Test/Data/List.purs +++ b/test/Test/Data/List.purs @@ -6,7 +6,7 @@ import Data.Array as Array import Data.Foldable (foldMap, foldl) import Data.FoldableWithIndex (foldMapWithIndex, foldlWithIndex, foldrWithIndex) import Data.Function (on) -import Data.List (List(..), Pattern(..), alterAt, catMaybes, concat, concatMap, delete, deleteAt, deleteBy, drop, dropEnd, dropWhile, elemIndex, elemLastIndex, filter, filterM, findIndex, findLastIndex, foldM, fromFoldable, group, groupAll, groupAllBy, groupBy, head, init, insert, insertAt, insertBy, intersect, intersectBy, last, length, mapMaybe, mapWithIndex, modifyAt, nub, nubBy, nubByEq, nubEq, null, partition, range, reverse, singleton, snoc, sort, sortBy, span, stripPrefix, tail, take, takeEnd, takeWhile, transpose, uncons, union, unionBy, unsnoc, unzip, updateAt, zip, zipWith, zipWithA, (!!), (..), (:), (\\)) +import Data.List (List(..), Pattern(..), alterAt, catMaybes, concat, concatMap, delete, deleteAt, deleteBy, drop, dropEnd, dropWhile, elemIndex, elemLastIndex, filter, filterM, findIndex, findLastIndex, foldM, fromFoldable, group, groupAll, groupAllBy, groupBy, head, init, insert, insertAt, insertBy, intersect, intersectBy, last, length, mapMaybe, modifyAt, nub, nubBy, nubByEq, nubEq, null, partition, range, reverse, singleton, snoc, sort, sortBy, span, stripPrefix, tail, take, takeEnd, takeWhile, transpose, uncons, union, unionBy, unsnoc, unzip, updateAt, zip, zipWith, zipWithA, (!!), (..), (:), (\\)) import Data.List.NonEmpty as NEL import Data.Maybe (Maybe(..), isNothing, fromJust) import Data.Monoid.Additive (Additive(..)) @@ -218,9 +218,6 @@ testList = do log "catMaybe should take an list of Maybe values and throw out Nothings" assert $ catMaybes (l [Nothing, Just 2, Nothing, Just 4]) == l [2, 4] - log "mapWithIndex should take a list of values and apply a function which also takes the index into account" - assert $ mapWithIndex (\x ix -> x + ix) (l [0, 1, 2, 3]) == l [0, 2, 4, 6] - log "sort should reorder a list into ascending order based on the result of compare" assert $ sort (l [1, 3, 2, 5, 6, 4]) == l [1, 2, 3, 4, 5, 6] diff --git a/test/Test/Data/List/NonEmpty.purs b/test/Test/Data/List/NonEmpty.purs index 6b8e54b..665338e 100644 --- a/test/Test/Data/List/NonEmpty.purs +++ b/test/Test/Data/List/NonEmpty.purs @@ -137,9 +137,6 @@ testNonEmptyList = do log "catMaybe should take an list of Maybe values and throw out Nothings" assert $ NEL.catMaybes (nel Nothing [Just 2, Nothing, Just 4]) == l [2, 4] - log "mapWithIndex should take a list of values and apply a function which also takes the index into account" - assert $ NEL.mapWithIndex (\x ix -> x + ix) (nel 0 [1, 2, 4]) == nel 0 [2, 4, 7] - log "sort should reorder a non-empty list into ascending order based on the result of compare" assert $ NEL.sort (nel 1 [3, 2, 5, 6, 4]) == nel 1 [2, 3, 4, 5, 6]