Skip to content

Fix warnings revealed by v0.14.1 PS release #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/Data/List.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.
-- |
Expand Down
4 changes: 2 additions & 2 deletions src/Data/List/Lazy.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
-- |
Expand Down
2 changes: 1 addition & 1 deletion src/Data/List/Lazy/NonEmpty.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Data/List/Lazy/Types.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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 } =
Expand Down
2 changes: 1 addition & 1 deletion src/Data/List/NonEmpty.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Data/List/Partial.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 3 additions & 3 deletions src/Data/List/Types.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 } =
Expand Down