diff --git a/CHANGELOG.md b/CHANGELOG.md index 5510d7b..81e8554 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ New features: Bugfixes: Other improvements: +- Fix warnings revealed by v0.14.1 PS release (#198) ## [v6.0.0](https://github.com/purescript/purescript-lists/releases/tag/v6.0.0) - 2021-02-26 diff --git a/src/Data/List.purs b/src/Data/List.purs index b697202..db9c1cd 100644 --- a/src/Data/List.purs +++ b/src/Data/List.purs @@ -271,7 +271,7 @@ uncons (x : xs) = Just { head: x, tail: xs } unsnoc :: forall a. List a -> Maybe { init :: List a, last :: a } unsnoc lst = (\h -> { init: reverse h.revInit, last: h.last }) <$> go lst Nil where - go Nil acc = Nothing + go Nil _ = Nothing go (x : Nil) acc = Just { revInit: acc, last: x } go (x : xs) acc = go xs (x : acc) @@ -325,7 +325,7 @@ insertAt _ _ _ = Nothing -- | -- | Running time: `O(n)` deleteAt :: forall a. Int -> List a -> Maybe (List a) -deleteAt 0 (y : ys) = Just ys +deleteAt 0 (_ : ys) = Just ys deleteAt n (y : ys) = (y : _) <$> deleteAt (n - 1) ys deleteAt _ _ = Nothing @@ -547,7 +547,7 @@ takeWhile p = go Nil drop :: forall a. Int -> List a -> List a drop n xs | n < 1 = xs drop _ Nil = Nil -drop n (x : xs) = drop (n - 1) xs +drop n (_ : xs) = drop (n - 1) xs -- | Drop the specified number of elements from the end of a list. -- | diff --git a/src/Data/List/Lazy.purs b/src/Data/List/Lazy.purs index 24ed8b9..8821753 100644 --- a/src/Data/List/Lazy.purs +++ b/src/Data/List/Lazy.purs @@ -348,7 +348,7 @@ deleteAt :: forall a. Int -> List a -> List a deleteAt n xs = List (go n <$> unwrap xs) where go _ Nil = Nil - go 0 (Cons y ys) = step ys + go 0 (Cons _ ys) = step ys go n' (Cons y ys) = Cons y (deleteAt (n' - 1) ys) -- | Update the element at the specified index, returning a new list, @@ -523,7 +523,7 @@ drop n = List <<< map (go n) <<< unwrap where go 0 xs = xs go _ Nil = Nil - go n' (Cons x xs) = go (n' - 1) (step xs) + go n' (Cons _ xs) = go (n' - 1) (step xs) -- | Drop those elements from the front of a list which match a predicate. -- | diff --git a/src/Data/List/Lazy/NonEmpty.purs b/src/Data/List/Lazy/NonEmpty.purs index 9d09506..20ef04a 100644 --- a/src/Data/List/Lazy/NonEmpty.purs +++ b/src/Data/List/Lazy/NonEmpty.purs @@ -73,7 +73,7 @@ uncons :: forall a. NonEmptyList a -> { head :: a, tail :: L.List a } uncons (NonEmptyList nel) = case force nel of x :| xs -> { head: x, tail: xs } length :: forall a. NonEmptyList a -> Int -length (NonEmptyList nel) = case force nel of x :| xs -> 1 + L.length xs +length (NonEmptyList nel) = case force nel of _ :| xs -> 1 + L.length xs concatMap :: forall a b. (a -> NonEmptyList b) -> NonEmptyList a -> NonEmptyList b concatMap = flip bind diff --git a/src/Data/List/Lazy/Types.purs b/src/Data/List/Lazy/Types.purs index fb70501..f313a79 100644 --- a/src/Data/List/Lazy/Types.purs +++ b/src/Data/List/Lazy/Types.purs @@ -199,7 +199,7 @@ instance extendList :: Extend List where extend f l = case step l of Nil -> nil - Cons a as -> + Cons _ as -> f l : (foldr go { val: nil, acc: nil } as).val where go a { val, acc } = diff --git a/src/Data/List/NonEmpty.purs b/src/Data/List/NonEmpty.purs index 49eace0..01c3db7 100644 --- a/src/Data/List/NonEmpty.purs +++ b/src/Data/List/NonEmpty.purs @@ -167,7 +167,7 @@ unsnoc (NonEmptyList (x :| xs)) = case L.unsnoc xs of Just un -> { init: x : un.init, last: un.last } length :: forall a. NonEmptyList a -> Int -length (NonEmptyList (x :| xs)) = 1 + L.length xs +length (NonEmptyList (_ :| xs)) = 1 + L.length xs index :: forall a. NonEmptyList a -> Int -> Maybe a index (NonEmptyList (x :| xs)) i diff --git a/src/Data/List/Partial.purs b/src/Data/List/Partial.purs index 8a063ba..7d7987f 100644 --- a/src/Data/List/Partial.purs +++ b/src/Data/List/Partial.purs @@ -26,5 +26,5 @@ last (Cons _ xs) = last xs -- | -- | Running time: `O(n)` init :: forall a. Partial => List a -> List a -init (Cons x Nil) = Nil +init (Cons _ Nil) = Nil init (Cons x xs) = Cons x (init xs) diff --git a/src/Data/List/Types.purs b/src/Data/List/Types.purs index eb2b28a..e27bc56 100644 --- a/src/Data/List/Types.purs +++ b/src/Data/List/Types.purs @@ -82,7 +82,7 @@ listMap :: forall a b. (a -> b) -> List a -> List b listMap f = chunkedRevMap Nil where chunkedRevMap :: List (List a) -> List a -> List b - chunkedRevMap chunksAcc chunk@(x1 : x2 : x3 : xs) = + chunkedRevMap chunksAcc chunk@(_ : _ : _ : xs) = chunkedRevMap (chunk : chunksAcc) xs chunkedRevMap chunksAcc xs = reverseUnrolledMap chunksAcc $ unrolledMap xs @@ -181,8 +181,8 @@ instance monadZeroList :: MonadZero List instance monadPlusList :: MonadPlus List instance extendList :: Extend List where - extend f Nil = Nil - extend f l@(a : as) = + extend _ Nil = Nil + extend f l@(_ : as) = f l : (foldr go { val: Nil, acc: Nil } as).val where go a' { val, acc } =