diff options
author | Bodigrim <andrew.lelechenko@gmail.com> | 2023-05-10 19:05:07 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-05-13 08:45:58 -0400 |
commit | 8a0d45f7d846e92cf4b6641fd8c67606412cdb3a (patch) | |
tree | 3bcd8a83820e419b254e632be69614b86b9ca5ba | |
parent | d85ed900b271109185251cb0494d51048a4cf213 (diff) | |
download | haskell-8a0d45f7d846e92cf4b6641fd8c67606412cdb3a.tar.gz |
Add more instances for Compose: Enum, Bounded, Num, Real, Integral
See https://github.com/haskell/core-libraries-committee/issues/160 for discussion
-rw-r--r-- | libraries/base/Data/Functor/Compose.hs | 11 | ||||
-rw-r--r-- | libraries/base/changelog.md | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/libraries/base/Data/Functor/Compose.hs b/libraries/base/Data/Functor/Compose.hs index d705e8ee70..ef2d305a7a 100644 --- a/libraries/base/Data/Functor/Compose.hs +++ b/libraries/base/Data/Functor/Compose.hs @@ -156,3 +156,14 @@ instance (TestEquality f) => TestEquality (Compose f g) where case testEquality x y of -- :: Maybe (g x :~: g y) Just Refl -> Just Refl -- :: Maybe (x :~: y) Nothing -> Nothing + +-- | @since 4.19.0.0 +deriving instance Enum (f (g a)) => Enum (Compose f g a) +-- | @since 4.19.0.0 +deriving instance Bounded (f (g a)) => Bounded (Compose f g a) +-- | @since 4.19.0.0 +deriving instance Num (f (g a)) => Num (Compose f g a) +-- | @since 4.19.0.0 +deriving instance Real (f (g a)) => Real (Compose f g a) +-- | @since 4.19.0.0 +deriving instance Integral (f (g a)) => Integral (Compose f g a) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 9daeaff8ab..a194bfad7f 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -25,6 +25,7 @@ adding the class `Unsatisfiable :: ErrorMessage -> TypeError` to `GHC.TypeError`, which provides a mechanism for custom type errors that reports the errors in a more predictable behaviour than `TypeError`. + * Add more instances for `Compose`: `Enum`, `Bounded`, `Num`, `Real`, `Integral` ([CLC proposal #160](https://github.com/haskell/core-libraries-committee/issues/160)) * Make `(&)` representation polymorphic in the return type ([CLC proposal #158](https://github.com/haskell/core-libraries-committee/issues/158)) * Implement `GHC.IORef.atomicSwapIORef` via a new dedicated primop `atomicSwapMutVar#` ([CLC proposal #139](https://github.com/haskell/core-libraries-committee/issues/139)) |