summaryrefslogtreecommitdiff
path: root/libraries/ghc-prim
diff options
context:
space:
mode:
authorDavid Feuer <David.Feuer@gmail.com>2021-08-31 03:42:30 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-09-18 12:01:10 -0400
commit7bc16521b93f9db62190dd4397a836e101932b8c (patch)
treeb8efd9e0ca0eba008d3c4b4e46b0dbdde76eb755 /libraries/ghc-prim
parent20e6fec8106521efe7c571612d6d4353fec5c832 (diff)
downloadhaskell-7bc16521b93f9db62190dd4397a836e101932b8c.tar.gz
Add more instances for Solo
Oleg Grenrus pointed out that `Solo` was missing `Eq`, `Ord`, `Bounded`, `Enum`, and `Ix` instances, which were all apparently available for the `OneTuple` type (in the `OneTuple` package). Though only the first three really seem useful, there's no reason not to take them all. For `Ix`, `Solo` naturally fills a gap between `()` and `(,)`.
Diffstat (limited to 'libraries/ghc-prim')
-rw-r--r--libraries/ghc-prim/GHC/Classes.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/libraries/ghc-prim/GHC/Classes.hs b/libraries/ghc-prim/GHC/Classes.hs
index fb9ea98581..2c874fb241 100644
--- a/libraries/ghc-prim/GHC/Classes.hs
+++ b/libraries/ghc-prim/GHC/Classes.hs
@@ -149,6 +149,7 @@ class Eq a where
{-# MINIMAL (==) | (/=) #-}
deriving instance Eq ()
+deriving instance Eq a => Eq (Solo a)
deriving instance (Eq a, Eq b) => Eq (a, b)
deriving instance (Eq a, Eq b, Eq c) => Eq (a, b, c)
deriving instance (Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d)
@@ -359,6 +360,7 @@ class (Eq a) => Ord a where
{-# MINIMAL compare | (<=) #-}
deriving instance Ord ()
+deriving instance Ord a => Ord (Solo a)
deriving instance (Ord a, Ord b) => Ord (a, b)
deriving instance (Ord a, Ord b, Ord c) => Ord (a, b, c)
deriving instance (Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d)