summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-02-01 22:48:01 -0500
committerBen Gamari <ben@smart-cactus.org>2017-02-01 23:37:27 -0500
commit5cb5b7a505d3cf87b4bdac31acae2a650221d05f (patch)
tree2d94eb35bd95dc3470f9e712c979e44ded7bde23 /libraries
parentd2b681bbdf8359b1813ea6c895498737eadc5261 (diff)
downloadhaskell-5cb5b7a505d3cf87b4bdac31acae2a650221d05f.tar.gz
base: Derive Enum, Bounded for VecCount, VecElem
Test Plan: Validate Reviewers: RyanGlScott, austin, hvr Reviewed By: RyanGlScott Subscribers: goldfire, RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D3059
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/GHC/Enum.hs12
-rw-r--r--libraries/base/changelog.md2
-rw-r--r--libraries/ghc-prim/GHC/Types.hs2
3 files changed, 16 insertions, 0 deletions
diff --git a/libraries/base/GHC/Enum.hs b/libraries/base/GHC/Enum.hs
index 50ca4a0b2b..feb45854d2 100644
--- a/libraries/base/GHC/Enum.hs
+++ b/libraries/base/GHC/Enum.hs
@@ -876,3 +876,15 @@ dn_list x0 delta lim = go (x0 :: Integer)
where
go x | x < lim = []
| otherwise = x : go (x+delta)
+
+-- Instances from GHC.Types
+
+-- | @since 4.10.0.0
+deriving instance Bounded VecCount
+-- | @since 4.10.0.0
+deriving instance Enum VecCount
+
+-- | @since 4.10.0.0
+deriving instance Bounded VecElem
+-- | @since 4.10.0.0
+deriving instance Enum VecElem
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index 40e18ff792..afb9e9f664 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -199,6 +199,8 @@
* The field `spInfoName` of `GHC.StaticPtr.StaticPtrInfo` has been removed.
The value is no longer available when constructing the `StaticPtr`.
+ * `VecElem` and `VecCount` now have `Enum` and `Bounded` instances.
+
### Generalizations
* Generalize `Debug.Trace.{traceM, traceShowM}` from `Monad` to `Applicative`
diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs
index 16a4921316..c913af6fdb 100644
--- a/libraries/ghc-prim/GHC/Types.hs
+++ b/libraries/ghc-prim/GHC/Types.hs
@@ -395,6 +395,7 @@ data VecCount = Vec2
| Vec16
| Vec32
| Vec64
+-- Enum, Bounded instances in GHC.Enum
-- | Element of a SIMD vector type
data VecElem = Int8ElemRep
@@ -407,6 +408,7 @@ data VecElem = Int8ElemRep
| Word64ElemRep
| FloatElemRep
| DoubleElemRep
+-- Enum, Bounded instances in GHC.Enum
{- *********************************************************************
* *