Commit 5cb5b7a5 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

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
parent d2b681bb
...@@ -1168,7 +1168,7 @@ liftedRepDataConTy, unliftedRepDataConTy, ...@@ -1168,7 +1168,7 @@ liftedRepDataConTy, unliftedRepDataConTy,
= map (mkTyConTy . promoteDataCon) runtimeRepSimpleDataCons = map (mkTyConTy . promoteDataCon) runtimeRepSimpleDataCons
vecCountTyCon :: TyCon vecCountTyCon :: TyCon
vecCountTyCon = pcNonEnumTyCon vecCountTyConName Nothing [] vecCountTyCon = pcTyCon True vecCountTyConName Nothing []
vecCountDataCons vecCountDataCons
-- See Note [Wiring in RuntimeRep] -- See Note [Wiring in RuntimeRep]
...@@ -1187,7 +1187,7 @@ vec2DataConTy, vec4DataConTy, vec8DataConTy, vec16DataConTy, vec32DataConTy, ...@@ -1187,7 +1187,7 @@ vec2DataConTy, vec4DataConTy, vec8DataConTy, vec16DataConTy, vec32DataConTy,
vec64DataConTy] = map (mkTyConTy . promoteDataCon) vecCountDataCons vec64DataConTy] = map (mkTyConTy . promoteDataCon) vecCountDataCons
vecElemTyCon :: TyCon vecElemTyCon :: TyCon
vecElemTyCon = pcNonEnumTyCon vecElemTyConName Nothing [] vecElemDataCons vecElemTyCon = pcTyCon True vecElemTyConName Nothing [] vecElemDataCons
-- See Note [Wiring in RuntimeRep] -- See Note [Wiring in RuntimeRep]
vecElemDataCons :: [DataCon] vecElemDataCons :: [DataCon]
......
...@@ -876,3 +876,15 @@ dn_list x0 delta lim = go (x0 :: Integer) ...@@ -876,3 +876,15 @@ dn_list x0 delta lim = go (x0 :: Integer)
where where
go x | x < lim = [] go x | x < lim = []
| otherwise = x : go (x+delta) | 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
...@@ -199,6 +199,8 @@ ...@@ -199,6 +199,8 @@
* The field `spInfoName` of `GHC.StaticPtr.StaticPtrInfo` has been removed. * The field `spInfoName` of `GHC.StaticPtr.StaticPtrInfo` has been removed.
The value is no longer available when constructing the `StaticPtr`. The value is no longer available when constructing the `StaticPtr`.
* `VecElem` and `VecCount` now have `Enum` and `Bounded` instances.
### Generalizations ### Generalizations
* Generalize `Debug.Trace.{traceM, traceShowM}` from `Monad` to `Applicative` * Generalize `Debug.Trace.{traceM, traceShowM}` from `Monad` to `Applicative`
......
...@@ -395,6 +395,7 @@ data VecCount = Vec2 ...@@ -395,6 +395,7 @@ data VecCount = Vec2
| Vec16 | Vec16
| Vec32 | Vec32
| Vec64 | Vec64
-- Enum, Bounded instances in GHC.Enum
-- | Element of a SIMD vector type -- | Element of a SIMD vector type
data VecElem = Int8ElemRep data VecElem = Int8ElemRep
...@@ -407,6 +408,7 @@ data VecElem = Int8ElemRep ...@@ -407,6 +408,7 @@ data VecElem = Int8ElemRep
| Word64ElemRep | Word64ElemRep
| FloatElemRep | FloatElemRep
| DoubleElemRep | DoubleElemRep
-- Enum, Bounded instances in GHC.Enum
{- ********************************************************************* {- *********************************************************************
* * * *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment