[Git][ghc/ghc][wip/CLC208] base: Introduce Data.Bounded and Data.Enum

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Feb 15 14:00:50 UTC 2024



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


Commits:
3642b584 by Ben Gamari at 2024-02-15T09:00:44-05:00
base: Introduce Data.Bounded and Data.Enum

As proposed in [CLC#208].

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

- - - - -


6 changed files:

- libraries/base/base.cabal
- libraries/base/changelog.md
- + libraries/base/src/Data/Bounded.hs
- libraries/ghc-internal/src/Data/Enum.hs → libraries/base/src/Data/Enum.hs
- libraries/ghc-internal/ghc-internal.cabal
- testsuite/tests/interface-stability/base-exports.stdout


Changes:

=====================================
libraries/base/base.cabal
=====================================
@@ -35,6 +35,7 @@ Library
         , Data.Bitraversable
         , Data.Char
         , Data.Complex
+        , Data.Enum
         , Data.Fixed
         , Data.Foldable1
         , Data.Functor.Classes
@@ -74,12 +75,12 @@ Library
         , Control.Monad.ST.Unsafe
         , Data.Bits
         , Data.Bool
+        , Data.Bounded
         , Data.Coerce
         , Data.Data
         , Data.Dynamic
         , Data.Either
         , Data.Eq
-        , Data.Enum
         , Data.Foldable
         , Data.Function
         , Data.Functor


=====================================
libraries/base/changelog.md
=====================================
@@ -8,6 +8,8 @@
   * Add laws relating between `Foldable` / `Traversable` with `Bifoldable` / `Bitraversable` ([CLC proposal #205](https://github.com/haskell/core-libraries-committee/issues/205))
   * The `Enum Int64` and `Enum Word64` instances now use native operations on 32-bit platforms, increasing performance by up to 1.5x on i386 and up to 5.6x with the JavaScript backend. ([CLC proposal #187](https://github.com/haskell/core-libraries-committee/issues/187))
   * Update to [Unicode 15.1.0](https://www.unicode.org/versions/Unicode15.1.0/).
+  * Introduce `Data.Bounded` exporting the `Bounded` typeclass ([CLC proposal #208](https://github.com/haskell/core-libraries-committee/issues/208))
+  * Introduce `Data.Enum` exporting the `Enum` typeclass ([CLC proposal #208](https://github.com/haskell/core-libraries-committee/issues/208))
   * Fix `withFile`, `withFileBlocking`, and `withBinaryFile` to not incorrectly annotate exceptions raised in wrapped computation. ([CLC proposal #237](https://github.com/haskell/core-libraries-committee/issues/237))
   * Fix `fdIsNonBlocking` to always be `0` for regular files and block devices on unix, regardless of `O_NONBLOCK`
   * Always use `safe` call to `read` for regular files and block devices on unix if the RTS is multi-threaded, regardless of `O_NONBLOCK`.


=====================================
libraries/base/src/Data/Bounded.hs
=====================================
@@ -0,0 +1,22 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Data.Enum
+-- 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' classes.
+--
+-----------------------------------------------------------------------------
+
+module Data.Bounded
+    ( Bounded(..)
+    ) where
+
+import GHC.Enum
+


=====================================
libraries/ghc-internal/src/Data/Enum.hs → libraries/base/src/Data/Enum.hs
=====================================
@@ -10,13 +10,12 @@
 -- Stability   :  stable
 -- Portability :  non-portable (GHC extensions)
 --
--- The 'Enum' and 'Bounded' classes.
+-- The 'Enum' class.
 --
 -----------------------------------------------------------------------------
 
 module Data.Enum
-    ( Bounded(..)
-    , Enum(..)
+    ( Enum(..)
     ) where
 
 import GHC.Enum


=====================================
libraries/ghc-internal/ghc-internal.cabal
=====================================
@@ -114,7 +114,6 @@ Library
         Data.Dynamic
         Data.Either
         Data.Eq
-        Data.Enum
         Data.Foldable
         Data.Function
         Data.Functor


=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -908,11 +908,6 @@ module Data.Either where
 
 module Data.Enum where
   -- Safety: Safe-Inferred
-  type Bounded :: * -> Constraint
-  class Bounded a where
-    minBound :: a
-    maxBound :: a
-    {-# MINIMAL minBound, maxBound #-}
   type Enum :: * -> Constraint
   class Enum a where
     succ :: a -> a



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3642b5844f5ec2d7b00d1eba519d73a79574c0db

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3642b5844f5ec2d7b00d1eba519d73a79574c0db
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/20240215/8c87b067/attachment-0001.html>


More information about the ghc-commits mailing list