[commit: ghc] wip/ttypeable: base: Derive Enum, Bounded for VecCount, VecElem (be9f9f2)

git at git.haskell.org git at git.haskell.org
Sun Jan 29 20:20:55 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/ttypeable
Link       : http://ghc.haskell.org/trac/ghc/changeset/be9f9f2bc7809ba78569f05a46dc2894152304ba/ghc

>---------------------------------------------------------------

commit be9f9f2bc7809ba78569f05a46dc2894152304ba
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Wed Nov 30 15:45:08 2016 -0500

    base: Derive Enum, Bounded for VecCount, VecElem


>---------------------------------------------------------------

be9f9f2bc7809ba78569f05a46dc2894152304ba
 compiler/prelude/TysWiredIn.hs  | 4 ++--
 libraries/base/GHC/Enum.hs      | 7 +++++++
 libraries/ghc-prim/GHC/Types.hs | 2 ++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs
index ff95d3a..ace7444 100644
--- a/compiler/prelude/TysWiredIn.hs
+++ b/compiler/prelude/TysWiredIn.hs
@@ -1168,7 +1168,7 @@ liftedRepDataConTy, unliftedRepDataConTy,
   = map (mkTyConTy . promoteDataCon) runtimeRepSimpleDataCons
 
 vecCountTyCon :: TyCon
-vecCountTyCon = pcNonEnumTyCon vecCountTyConName Nothing []
+vecCountTyCon = pcTyCon True vecCountTyConName Nothing []
                         vecCountDataCons
 
 -- See Note [Wiring in RuntimeRep]
@@ -1187,7 +1187,7 @@ vec2DataConTy, vec4DataConTy, vec8DataConTy, vec16DataConTy, vec32DataConTy,
   vec64DataConTy] = map (mkTyConTy . promoteDataCon) vecCountDataCons
 
 vecElemTyCon :: TyCon
-vecElemTyCon = pcNonEnumTyCon vecElemTyConName Nothing [] vecElemDataCons
+vecElemTyCon = pcTyCon True vecElemTyConName Nothing [] vecElemDataCons
 
 -- See Note [Wiring in RuntimeRep]
 vecElemDataCons :: [DataCon]
diff --git a/libraries/base/GHC/Enum.hs b/libraries/base/GHC/Enum.hs
index 50ca4a0..2cec6c6 100644
--- a/libraries/base/GHC/Enum.hs
+++ b/libraries/base/GHC/Enum.hs
@@ -876,3 +876,10 @@ dn_list x0 delta lim = go (x0 :: Integer)
                     where
                         go x | x < lim   = []
                              | otherwise = x : go (x+delta)
+
+-- Instances from GHC.Types
+deriving instance Bounded VecCount
+deriving instance Enum VecCount
+
+deriving instance Bounded VecElem
+deriving instance Enum VecElem
diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs
index d36739e..b71559a 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
 
 {- *********************************************************************
 *                                                                      *



More information about the ghc-commits mailing list