[Git][ghc/ghc][wip/CLC208] 3 commits: base: Introduce Data.Bounded

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Dec 5 00:43:28 UTC 2024



Ben Gamari pushed to branch wip/CLC208 at Glasgow Haskell Compiler / GHC


Commits:
5c4ecd35 by Ben Gamari at 2024-12-04T19:43:22-05:00
base: Introduce Data.Bounded

As proposed in [CLC#208] but unfortunately `Data.Enum` was already
incorrectly introduced in the `ghc-internal` refactor.

[CLC#208]: https://github.com/haskell/core-libraries-committee/issues/208

- - - - -
e32005aa by Ben Gamari at 2024-12-04T19:43:22-05:00
base: Deprecate export of Bounded from Data.Enum

This begins the process of bringing us into compliance with
[CLC#208].

[CLC#208]: https://github.com/haskell/core-libraries-committee/issues/208

- - - - -
436d2cd5 by Ben Gamari at 2024-12-04T19:43:22-05:00
base: Mention incorrect Data.Enum addition in changelog

- - - - -


8 changed files:

- libraries/base/base.cabal.in
- libraries/base/changelog.md
- + libraries/base/src/Data/Bounded.hs
- libraries/base/src/Data/Enum.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/base.cabal.in
=====================================
@@ -46,8 +46,10 @@ Library
         , Data.Bifoldable1
         , Data.Bifunctor
         , Data.Bitraversable
+        , Data.Bounded
         , Data.Char
         , Data.Complex
+        , Data.Enum
         , Data.Fixed
         , Data.Foldable1
         , Data.Functor.Classes
@@ -95,7 +97,6 @@ Library
         , Data.Dynamic
         , Data.Either
         , Data.Eq
-        , Data.Enum
         , Data.Foldable
         , Data.Function
         , Data.Functor


=====================================
libraries/base/changelog.md
=====================================
@@ -7,6 +7,8 @@
   * `Data.List.NonEmpty.{init,last,tails1}` are now defined using only total functions (rather than partial ones). ([CLC proposal #293](https://github.com/haskell/core-libraries-committee/issues/293))
 
 ## 4.21.0.0 *TBA*
+  * Introduce `Data.Bounded` module exporting the `Bounded` typeclass (finishing [CLC proposal #208](https://github.com/haskell/core-libraries-committee/issues/208))
+  * Deprecate export of `Bounded` class from `Data.Enum` ([CLC proposal #208](https://github.com/haskell/core-libraries-committee/issues/208))
   * `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))
   * Add `compareLength` to `Data.List` and `Data.List.NonEmpty` ([CLC proposal #257](https://github.com/haskell/core-libraries-committee/issues/257))
@@ -51,8 +53,9 @@
           `ioError` to prevent leaking the implementation of these error functions
           into the callstack.
 
-## 4.20.0.0 May 2024
+## 4.20.0.0 *May 2024*
   * Shipped with GHC 9.10.1
+  * Introduce `Data.Enum` module exporting both `Enum` and `Bounded`. Note that the export of `Bounded` will be deprecated in a future release ([CLC proposal #208](https://github.com/haskell/core-libraries-committee/issues/208))
   * Deprecate `GHC.Pack` ([#21461](https://gitlab.haskell.org/ghc/ghc/-/issues/21461))
   * Export `foldl'` from `Prelude` ([CLC proposal #167](https://github.com/haskell/core-libraries-committee/issues/167))
   * The top-level handler for uncaught exceptions now displays the output of `displayException` rather than `show`  ([CLC proposal #198](https://github.com/haskell/core-libraries-committee/issues/198))


=====================================
libraries/base/src/Data/Bounded.hs
=====================================
@@ -0,0 +1,25 @@
+{-# LANGUAGE Safe #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Data.Bounded
+-- Copyright   :  (c) The University of Glasgow, 1992-2002
+-- License     :  see libraries/base/LICENSE
+--
+-- Maintainer  :  cvs-ghc at haskell.org
+-- Stability   :  stable
+-- Portability :  non-portable (GHC extensions)
+--
+-- The 'Bounded' class.
+--
+-- @since 4.22.0.0
+--
+-----------------------------------------------------------------------------
+
+module Data.Bounded
+    ( Bounded(..)
+    ) where
+
+import GHC.Enum
+


=====================================
libraries/base/src/Data/Enum.hs
=====================================
@@ -1,7 +1,8 @@
 {-# LANGUAGE Safe #-}
+{-# LANGUAGE NoImplicitPrelude #-}
 
+-----------------------------------------------------------------------------
 -- |
---
 -- Module      :  Data.Enum
 -- Copyright   :  (c) The University of Glasgow, 1992-2002
 -- License     :  see libraries/base/LICENSE
@@ -10,12 +11,16 @@
 -- Stability   :  stable
 -- Portability :  non-portable (GHC extensions)
 --
--- The 'Enum' and 'Bounded' classes.
+-- The 'Enum' class.
+--
+-- @since 4.20.0.0
 --
+-----------------------------------------------------------------------------
 
 module Data.Enum
-    (Bounded(..),
-     Enum(..)
-     ) where
+    ( Enum(..)
+    , {-# DEPRECATED "Bounded should be imported from Data.Bounded" #-}
+      Bounded(..)
+    ) where
 
 import GHC.Internal.Enum


=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -751,6 +751,14 @@ module Data.Bool where
   otherwise :: Bool
   (||) :: Bool -> Bool -> Bool
 
+module Data.Bounded where
+  -- Safety: Safe
+  type Bounded :: * -> Constraint
+  class Bounded a where
+    minBound :: a
+    maxBound :: a
+    {-# MINIMAL minBound, maxBound #-}
+
 module Data.Char where
   -- Safety: Trustworthy
   type Char :: *


=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -751,6 +751,14 @@ module Data.Bool where
   otherwise :: Bool
   (||) :: Bool -> Bool -> Bool
 
+module Data.Bounded where
+  -- Safety: Safe
+  type Bounded :: * -> Constraint
+  class Bounded a where
+    minBound :: a
+    maxBound :: a
+    {-# MINIMAL minBound, maxBound #-}
+
 module Data.Char where
   -- Safety: Trustworthy
   type Char :: *


=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -751,6 +751,14 @@ module Data.Bool where
   otherwise :: Bool
   (||) :: Bool -> Bool -> Bool
 
+module Data.Bounded where
+  -- Safety: Safe
+  type Bounded :: * -> Constraint
+  class Bounded a where
+    minBound :: a
+    maxBound :: a
+    {-# MINIMAL minBound, maxBound #-}
+
 module Data.Char where
   -- Safety: Trustworthy
   type Char :: *


=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -751,6 +751,14 @@ module Data.Bool where
   otherwise :: Bool
   (||) :: Bool -> Bool -> Bool
 
+module Data.Bounded where
+  -- Safety: Safe
+  type Bounded :: * -> Constraint
+  class Bounded a where
+    minBound :: a
+    maxBound :: a
+    {-# MINIMAL minBound, maxBound #-}
+
 module Data.Char where
   -- Safety: Trustworthy
   type Char :: *



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6e8882810976ce9c3d8b54551e710d72fcf0addb...436d2cd58bce2e468d51e254ded95479b1791165

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6e8882810976ce9c3d8b54551e710d72fcf0addb...436d2cd58bce2e468d51e254ded95479b1791165
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/20241204/1625fef5/attachment-0001.html>


More information about the ghc-commits mailing list