[Git][ghc/ghc][master] Restrict Data.List.NonEmpty.unzip to NonEmpty (a, b) -> (NonEmpty a, NonEmpty b)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sat Oct 5 14:37:15 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
4327f0e8 by Andrew Lelechenko at 2024-10-05T10:36:52-04:00
Restrict Data.List.NonEmpty.unzip to NonEmpty (a, b) -> (NonEmpty a, NonEmpty b)

Implementing the final phase of CLC proposal https://github.com/haskell/core-libraries-committee/issues/86

- - - - -


6 changed files:

- libraries/base/changelog.md
- libraries/base/src/Data/List/NonEmpty.hs
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32


Changes:

=====================================
libraries/base/changelog.md
=====================================
@@ -1,5 +1,8 @@
 # Changelog for [`base` package](http://hackage.haskell.org/package/base)
 
+## 4.22.0.0 *TBA*
+  * Restrict `Data.List.NonEmpty.unzip` to `NonEmpty (a, b) -> (NonEmpty a, NonEmpty b)`. ([CLC proposal #86](https://github.com/haskell/core-libraries-committee/issues/86))
+
 ## 4.21.0.0 *TBA*
   * `GHC.Desugar` has been deprecated and should be removed in GHC 9.14. ([CLC proposal #216](https://github.com/haskell/core-libraries-committee/issues/216))
   * Add a `readTixFile` field to the `HpcFlags` record in `GHC.RTS.Flags` ([CLC proposal #276](https://github.com/haskell/core-libraries-committee/issues/276))


=====================================
libraries/base/src/Data/List/NonEmpty.hs
=====================================
@@ -537,11 +537,9 @@ isPrefixOf (y:ys) (x :| xs) = (y == x) && List.isPrefixOf ys xs
   | otherwise = error "NonEmpty.!! negative index"
 infixl 9 !!
 
-
 -- | The 'unzip' function is the inverse of the 'zip' function.
-unzip :: Functor f => f (a,b) -> (f a, f b)
+unzip :: NonEmpty (a, b) -> (NonEmpty a, NonEmpty b)
 unzip xs = (fst <$> xs, snd <$> xs)
-{-# WARNING in "x-data-list-nonempty-unzip" unzip "This function will be made monomorphic in base-4.22, consider switching to Data.Functor.unzip" #-}
 
 -- | The 'nub' function removes duplicate elements from a list. In
 -- particular, it keeps only the first occurrence of each element.


=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -1486,7 +1486,7 @@ module Data.List.NonEmpty where
   uncons :: forall a. NonEmpty a -> (a, GHC.Internal.Maybe.Maybe (NonEmpty a))
   unfold :: forall a b. (a -> (b, GHC.Internal.Maybe.Maybe a)) -> a -> NonEmpty b
   unfoldr :: forall a b. (a -> (b, GHC.Internal.Maybe.Maybe a)) -> a -> NonEmpty b
-  unzip :: forall (f :: * -> *) a b. GHC.Internal.Base.Functor f => f (a, b) -> (f a, f b)
+  unzip :: forall a b. NonEmpty (a, b) -> (NonEmpty a, NonEmpty b)
   xor :: NonEmpty GHC.Types.Bool -> GHC.Types.Bool
   zip :: forall a b. NonEmpty a -> NonEmpty b -> NonEmpty (a, b)
   zipWith :: forall a b c. (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c


=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -1486,7 +1486,7 @@ module Data.List.NonEmpty where
   uncons :: forall a. NonEmpty a -> (a, GHC.Internal.Maybe.Maybe (NonEmpty a))
   unfold :: forall a b. (a -> (b, GHC.Internal.Maybe.Maybe a)) -> a -> NonEmpty b
   unfoldr :: forall a b. (a -> (b, GHC.Internal.Maybe.Maybe a)) -> a -> NonEmpty b
-  unzip :: forall (f :: * -> *) a b. GHC.Internal.Base.Functor f => f (a, b) -> (f a, f b)
+  unzip :: forall a b. NonEmpty (a, b) -> (NonEmpty a, NonEmpty b)
   xor :: NonEmpty GHC.Types.Bool -> GHC.Types.Bool
   zip :: forall a b. NonEmpty a -> NonEmpty b -> NonEmpty (a, b)
   zipWith :: forall a b c. (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c


=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -1486,7 +1486,7 @@ module Data.List.NonEmpty where
   uncons :: forall a. NonEmpty a -> (a, GHC.Internal.Maybe.Maybe (NonEmpty a))
   unfold :: forall a b. (a -> (b, GHC.Internal.Maybe.Maybe a)) -> a -> NonEmpty b
   unfoldr :: forall a b. (a -> (b, GHC.Internal.Maybe.Maybe a)) -> a -> NonEmpty b
-  unzip :: forall (f :: * -> *) a b. GHC.Internal.Base.Functor f => f (a, b) -> (f a, f b)
+  unzip :: forall a b. NonEmpty (a, b) -> (NonEmpty a, NonEmpty b)
   xor :: NonEmpty GHC.Types.Bool -> GHC.Types.Bool
   zip :: forall a b. NonEmpty a -> NonEmpty b -> NonEmpty (a, b)
   zipWith :: forall a b c. (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c


=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -1486,7 +1486,7 @@ module Data.List.NonEmpty where
   uncons :: forall a. NonEmpty a -> (a, GHC.Internal.Maybe.Maybe (NonEmpty a))
   unfold :: forall a b. (a -> (b, GHC.Internal.Maybe.Maybe a)) -> a -> NonEmpty b
   unfoldr :: forall a b. (a -> (b, GHC.Internal.Maybe.Maybe a)) -> a -> NonEmpty b
-  unzip :: forall (f :: * -> *) a b. GHC.Internal.Base.Functor f => f (a, b) -> (f a, f b)
+  unzip :: forall a b. NonEmpty (a, b) -> (NonEmpty a, NonEmpty b)
   xor :: NonEmpty GHC.Types.Bool -> GHC.Types.Bool
   zip :: forall a b. NonEmpty a -> NonEmpty b -> NonEmpty (a, b)
   zipWith :: forall a b c. (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4327f0e8c5091dae9ab0f58e2e3c8af5bacd12ea

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4327f0e8c5091dae9ab0f58e2e3c8af5bacd12ea
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241005/b6c297fb/attachment-0001.html>


More information about the ghc-commits mailing list