diff options
author | sheaf <sam.derbyshire@gmail.com> | 2022-02-24 13:44:40 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-25 21:12:47 -0500 |
commit | 7f9f49c3319ce0fbcbc728f3ff04b7cc1f74de24 (patch) | |
tree | f9a584c7892dbd24da9b1a3ee59f6077140c25f8 | |
parent | 9c3edeb8124d0276d7bb29ac3e13016f0d57c7a5 (diff) | |
download | haskell-7f9f49c3319ce0fbcbc728f3ff04b7cc1f74de24.tar.gz |
Derive some stock instances for OverridingBool
This patch adds some derived instances to
`GHC.Data.Bool.OverridingBool`. It also changes the order of the
constructors, so that the derived `Ord` instance matches the
behaviour for `Maybe Bool`.
Fixes #20326
-rw-r--r-- | compiler/GHC/Data/Bool.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/GHC/Data/Bool.hs b/compiler/GHC/Data/Bool.hs index 1428e7d2fd..ab38f8fe78 100644 --- a/compiler/GHC/Data/Bool.hs +++ b/compiler/GHC/Data/Bool.hs @@ -8,11 +8,18 @@ import GHC.Prelude data OverridingBool = Auto - | Always | Never - deriving Show + | Always + deriving + ( Show + , Read -- ^ @since 9.4.1 + , Eq -- ^ @since 9.4.1 + , Ord -- ^ @since 9.4.1 + , Enum -- ^ @since 9.4.1 + , Bounded -- ^ @since 9.4.1 + ) overrideWith :: Bool -> OverridingBool -> Bool overrideWith b Auto = b -overrideWith _ Always = True overrideWith _ Never = False +overrideWith _ Always = True |