diff options
author | Chaitanya Koparkar <ckoparkar@gmail.com> | 2018-03-02 16:12:56 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-03-02 16:13:07 -0500 |
commit | 5c28ee88dd66617b0fd5dbe0d90142ce983a547e (patch) | |
tree | 8322c8ec668e4a3db7eeafe6ac11f113ea570094 /libraries/base/Data | |
parent | 6a7e159ce25b432824f8757e0c768f2b2e2754df (diff) | |
download | haskell-5c28ee88dd66617b0fd5dbe0d90142ce983a547e.tar.gz |
Add @since annotations for derived instances in base
Test Plan: ./validate
Reviewers: hvr, goldfire, bgamari, RyanGlScott
Reviewed By: RyanGlScott
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #11767
Differential Revision: https://phabricator.haskell.org/D4452
Diffstat (limited to 'libraries/base/Data')
-rw-r--r-- | libraries/base/Data/Complex.hs | 12 | ||||
-rw-r--r-- | libraries/base/Data/Data.hs | 14 | ||||
-rw-r--r-- | libraries/base/Data/Either.hs | 7 | ||||
-rw-r--r-- | libraries/base/Data/Fixed.hs | 6 | ||||
-rw-r--r-- | libraries/base/Data/Foldable.hs | 27 | ||||
-rw-r--r-- | libraries/base/Data/Functor/Compose.hs | 5 | ||||
-rw-r--r-- | libraries/base/Data/Functor/Const.hs | 23 | ||||
-rw-r--r-- | libraries/base/Data/Functor/Identity.hs | 23 | ||||
-rw-r--r-- | libraries/base/Data/Functor/Product.hs | 5 | ||||
-rw-r--r-- | libraries/base/Data/Functor/Sum.hs | 5 | ||||
-rw-r--r-- | libraries/base/Data/Monoid.hs | 24 | ||||
-rw-r--r-- | libraries/base/Data/Ord.hs | 10 | ||||
-rw-r--r-- | libraries/base/Data/Proxy.hs | 4 | ||||
-rw-r--r-- | libraries/base/Data/Semigroup.hs | 70 | ||||
-rw-r--r-- | libraries/base/Data/Semigroup/Internal.hs | 64 | ||||
-rw-r--r-- | libraries/base/Data/String.hs | 2 | ||||
-rw-r--r-- | libraries/base/Data/Traversable.hs | 28 | ||||
-rw-r--r-- | libraries/base/Data/Type/Coercion.hs | 5 | ||||
-rw-r--r-- | libraries/base/Data/Type/Equality.hs | 5 | ||||
-rw-r--r-- | libraries/base/Data/Version.hs | 5 |
20 files changed, 296 insertions, 48 deletions
diff --git a/libraries/base/Data/Complex.hs b/libraries/base/Data/Complex.hs index e4ed4e8deb..073f5c5e86 100644 --- a/libraries/base/Data/Complex.hs +++ b/libraries/base/Data/Complex.hs @@ -58,8 +58,16 @@ infix 6 :+ data Complex a = !a :+ !a -- ^ forms a complex number from its real and imaginary -- rectangular components. - deriving (Eq, Show, Read, Data, Generic, Generic1 - , Functor, Foldable, Traversable) + deriving ( Eq -- ^ @since 2.01 + , Show -- ^ @since 2.01 + , Read -- ^ @since 2.01 + , Data -- ^ @since 2.01 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + , Functor -- ^ @since 4.9.0.0 + , Foldable -- ^ @since 4.9.0.0 + , Traversable -- ^ @since 4.9.0.0 + ) -- ----------------------------------------------------------------------------- -- Functions over Complex diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs index e22f7cb082..930b4b8883 100644 --- a/libraries/base/Data/Data.hs +++ b/libraries/base/Data/Data.hs @@ -511,7 +511,7 @@ data DataType = DataType , datarep :: DataRep } - deriving Show + deriving Show -- ^ @since 4.0.0.0 -- | Representation of constructors. Note that equality on constructors -- with different types may not work -- i.e. the constructors for 'False' and @@ -543,7 +543,9 @@ data DataRep = AlgRep [Constr] | CharRep | NoRep - deriving (Eq,Show) + deriving ( Eq -- ^ @since 4.0.0.0 + , Show -- ^ @since 4.0.0.0 + ) -- The list of constructors could be an array, a balanced tree, or others. @@ -553,7 +555,9 @@ data ConstrRep = AlgConstr ConIndex | FloatConstr Rational | CharConstr Char - deriving (Eq,Show) + deriving ( Eq -- ^ @since 4.0.0.0 + , Show -- ^ @since 4.0.0.0 + ) -- | Unique index for datatype constructors, @@ -565,7 +569,9 @@ type ConIndex = Int data Fixity = Prefix | Infix -- Later: add associativity and precedence - deriving (Eq,Show) + deriving ( Eq -- ^ @since 4.0.0.0 + , Show -- ^ @since 4.0.0.0 + ) ------------------------------------------------------------------------------ diff --git a/libraries/base/Data/Either.hs b/libraries/base/Data/Either.hs index c5ff7c0180..5f23a3edc2 100644 --- a/libraries/base/Data/Either.hs +++ b/libraries/base/Data/Either.hs @@ -123,7 +123,11 @@ Left "parse error" -} data Either a b = Left a | Right b - deriving (Eq, Ord, Read, Show) + deriving ( Eq -- ^ @since 2.01 + , Ord -- ^ @since 2.01 + , Read -- ^ @since 3.0 + , Show -- ^ @since 3.0 + ) -- | @since 3.0 instance Functor (Either a) where @@ -336,4 +340,3 @@ prop_partitionEithers :: [Either Int Int] -> Bool prop_partitionEithers x = partitionEithers x == (lefts x, rights x) -} - diff --git a/libraries/base/Data/Fixed.hs b/libraries/base/Data/Fixed.hs index e5e1f2f746..b8db351257 100644 --- a/libraries/base/Data/Fixed.hs +++ b/libraries/base/Data/Fixed.hs @@ -57,8 +57,10 @@ mod' n d = n - (fromInteger f) * d where f = div' n d -- | The type parameter should be an instance of 'HasResolution'. -newtype Fixed a = MkFixed Integer -- ^ @since 4.7.0.0 - deriving (Eq,Ord) +newtype Fixed a = MkFixed Integer + deriving ( Eq -- ^ @since 2.01 + , Ord -- ^ @since 2.01 + ) -- We do this because the automatically derived Data instance requires (Data a) context. -- Our manual instance has the more general (Typeable a) context. diff --git a/libraries/base/Data/Foldable.hs b/libraries/base/Data/Foldable.hs index 2656efa103..3fa57485d6 100644 --- a/libraries/base/Data/Foldable.hs +++ b/libraries/base/Data/Foldable.hs @@ -439,19 +439,46 @@ instance Foldable U1 where sum _ = 0 product _ = 1 +-- | @since 4.9.0.0 deriving instance Foldable V1 + +-- | @since 4.9.0.0 deriving instance Foldable Par1 + +-- | @since 4.9.0.0 deriving instance Foldable f => Foldable (Rec1 f) + +-- | @since 4.9.0.0 deriving instance Foldable (K1 i c) + +-- | @since 4.9.0.0 deriving instance Foldable f => Foldable (M1 i c f) + +-- | @since 4.9.0.0 deriving instance (Foldable f, Foldable g) => Foldable (f :+: g) + +-- | @since 4.9.0.0 deriving instance (Foldable f, Foldable g) => Foldable (f :*: g) + +-- | @since 4.9.0.0 deriving instance (Foldable f, Foldable g) => Foldable (f :.: g) + +-- | @since 4.9.0.0 deriving instance Foldable UAddr + +-- | @since 4.9.0.0 deriving instance Foldable UChar + +-- | @since 4.9.0.0 deriving instance Foldable UDouble + +-- | @since 4.9.0.0 deriving instance Foldable UFloat + +-- | @since 4.9.0.0 deriving instance Foldable UInt + +-- | @since 4.9.0.0 deriving instance Foldable UWord -- | Monadic fold over the elements of a structure, diff --git a/libraries/base/Data/Functor/Compose.hs b/libraries/base/Data/Functor/Compose.hs index 68fbfc630a..8ceadb8572 100644 --- a/libraries/base/Data/Functor/Compose.hs +++ b/libraries/base/Data/Functor/Compose.hs @@ -38,7 +38,10 @@ infixr 9 `Compose` -- The composition of applicative functors is always applicative, -- but the composition of monads is not always a monad. newtype Compose f g a = Compose { getCompose :: f (g a) } - deriving (Data, Generic, Generic1) + deriving ( Data -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + ) -- Instances of lifted Prelude classes diff --git a/libraries/base/Data/Functor/Const.hs b/libraries/base/Data/Functor/Const.hs index 8a33e580ad..028ae208c3 100644 --- a/libraries/base/Data/Functor/Const.hs +++ b/libraries/base/Data/Functor/Const.hs @@ -37,9 +37,26 @@ import GHC.Show (Show(showsPrec), showParen, showString) -- | The 'Const' functor. newtype Const a b = Const { getConst :: a } - deriving ( Bits, Bounded, Enum, Eq, FiniteBits, Floating, Fractional - , Generic, Generic1, Integral, Ix, Semigroup, Monoid, Num, Ord - , Real, RealFrac, RealFloat, Storable) + deriving ( Bits -- ^ @since 4.9.0.0 + , Bounded -- ^ @since 4.9.0.0 + , Enum -- ^ @since 4.9.0.0 + , Eq -- ^ @since 4.9.0.0 + , FiniteBits -- ^ @since 4.9.0.0 + , Floating -- ^ @since 4.9.0.0 + , Fractional -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + , Integral -- ^ @since 4.9.0.0 + , Ix -- ^ @since 4.9.0.0 + , Semigroup -- ^ @since 4.9.0.0 + , Monoid -- ^ @since 4.9.0.0 + , Num -- ^ @since 4.9.0.0 + , Ord -- ^ @since 4.9.0.0 + , Real -- ^ @since 4.9.0.0 + , RealFrac -- ^ @since 4.9.0.0 + , RealFloat -- ^ @since 4.9.0.0 + , Storable -- ^ @since 4.9.0.0 + ) -- | This instance would be equivalent to the derived instances of the -- 'Const' newtype if the 'runConst' field were removed diff --git a/libraries/base/Data/Functor/Identity.hs b/libraries/base/Data/Functor/Identity.hs index 41c32d0d15..daaa3a450c 100644 --- a/libraries/base/Data/Functor/Identity.hs +++ b/libraries/base/Data/Functor/Identity.hs @@ -57,9 +57,26 @@ import GHC.Types (Bool(..)) -- -- @since 4.8.0.0 newtype Identity a = Identity { runIdentity :: a } - deriving ( Bits, Bounded, Enum, Eq, FiniteBits, Floating, Fractional - , Generic, Generic1, Integral, Ix, Semigroup, Monoid, Num, Ord - , Real, RealFrac, RealFloat, Storable) + deriving ( Bits -- ^ @since 4.9.0.0 + , Bounded -- ^ @since 4.9.0.0 + , Enum -- ^ @since 4.9.0.0 + , Eq -- ^ @since 4.8.0.0 + , FiniteBits -- ^ @since 4.9.0.0 + , Floating -- ^ @since 4.9.0.0 + , Fractional -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.8.0.0 + , Generic1 -- ^ @since 4.8.0.0 + , Integral -- ^ @since 4.9.0.0 + , Ix -- ^ @since 4.9.0.0 + , Semigroup -- ^ @since 4.9.0.0 + , Monoid -- ^ @since 4.9.0.0 + , Num -- ^ @since 4.9.0.0 + , Ord -- ^ @since 4.8.0.0 + , Real -- ^ @since 4.9.0.0 + , RealFrac -- ^ @since 4.9.0.0 + , RealFloat -- ^ @since 4.9.0.0 + , Storable -- ^ @since 4.9.0.0 + ) -- | This instance would be equivalent to the derived instances of the -- 'Identity' newtype if the 'runIdentity' field were removed diff --git a/libraries/base/Data/Functor/Product.hs b/libraries/base/Data/Functor/Product.hs index 7676aa5f0c..d98d31ea59 100644 --- a/libraries/base/Data/Functor/Product.hs +++ b/libraries/base/Data/Functor/Product.hs @@ -35,7 +35,10 @@ import Text.Read (Read(..), readListDefault, readListPrecDefault) -- | Lifted product of functors. data Product f g a = Pair (f a) (g a) - deriving (Data, Generic, Generic1) + deriving ( Data -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + ) -- | @since 4.9.0.0 instance (Eq1 f, Eq1 g) => Eq1 (Product f g) where diff --git a/libraries/base/Data/Functor/Sum.hs b/libraries/base/Data/Functor/Sum.hs index f18feae2f0..68e60fe817 100644 --- a/libraries/base/Data/Functor/Sum.hs +++ b/libraries/base/Data/Functor/Sum.hs @@ -31,7 +31,10 @@ import Text.Read (Read(..), readListDefault, readListPrecDefault) -- | Lifted sum of functors. data Sum f g a = InL (f a) | InR (g a) - deriving (Data, Generic, Generic1) + deriving ( Data -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + ) -- | @since 4.9.0.0 instance (Eq1 f, Eq1 g) => Eq1 (Sum f g) where diff --git a/libraries/base/Data/Monoid.hs b/libraries/base/Data/Monoid.hs index 1284a078ce..b6d09c1f2d 100644 --- a/libraries/base/Data/Monoid.hs +++ b/libraries/base/Data/Monoid.hs @@ -89,8 +89,16 @@ import Data.Semigroup.Internal -- >>> getFirst (First (Just "hello") <> First Nothing <> First (Just "world")) -- Just "hello" newtype First a = First { getFirst :: Maybe a } - deriving (Eq, Ord, Read, Show, Generic, Generic1, - Functor, Applicative, Monad) + deriving ( Eq -- ^ @since 2.01 + , Ord -- ^ @since 2.01 + , Read -- ^ @since 2.01 + , Show -- ^ @since 2.01 + , Generic -- ^ @since 4.7.0.0 + , Generic1 -- ^ @since 4.7.0.0 + , Functor -- ^ @since 4.8.0.0 + , Applicative -- ^ @since 4.8.0.0 + , Monad -- ^ @since 4.8.0.0 + ) -- | @since 4.9.0.0 instance Semigroup (First a) where @@ -110,8 +118,16 @@ instance Monoid (First a) where -- >>> getLast (Last (Just "hello") <> Last Nothing <> Last (Just "world")) -- Just "world" newtype Last a = Last { getLast :: Maybe a } - deriving (Eq, Ord, Read, Show, Generic, Generic1, - Functor, Applicative, Monad) + deriving ( Eq -- ^ @since 2.01 + , Ord -- ^ @since 2.01 + , Read -- ^ @since 2.01 + , Show -- ^ @since 2.01 + , Generic -- ^ @since 4.7.0.0 + , Generic1 -- ^ @since 4.7.0.0 + , Functor -- ^ @since 4.8.0.0 + , Applicative -- ^ @since 4.8.0.0 + , Monad -- ^ @since 4.8.0.0 + ) -- | @since 4.9.0.0 instance Semigroup (Last a) where diff --git a/libraries/base/Data/Ord.hs b/libraries/base/Data/Ord.hs index 2f5798cca2..c6b7e59543 100644 --- a/libraries/base/Data/Ord.hs +++ b/libraries/base/Data/Ord.hs @@ -48,12 +48,12 @@ comparing p x y = compare (p x) (p y) -- @since 4.6.0.0 newtype Down a = Down a deriving - ( Eq - , Show -- ^ @since 4.7.0.0 - , Read -- ^ @since 4.7.0.0 - , Num -- ^ @since 4.11.0.0 + ( Eq -- ^ @since 4.6.0.0 + , Show -- ^ @since 4.7.0.0 + , Read -- ^ @since 4.7.0.0 + , Num -- ^ @since 4.11.0.0 , Semigroup -- ^ @since 4.11.0.0 - , Monoid -- ^ @since 4.11.0.0 + , Monoid -- ^ @since 4.11.0.0 ) -- | @since 4.6.0.0 diff --git a/libraries/base/Data/Proxy.hs b/libraries/base/Data/Proxy.hs index 4f824d0e3c..cdbb0d4956 100644 --- a/libraries/base/Data/Proxy.hs +++ b/libraries/base/Data/Proxy.hs @@ -53,8 +53,8 @@ import GHC.Arr -- -- >>> Proxy :: Proxy complicatedStructure -- Proxy -data Proxy t = Proxy deriving ( Bounded - , Read -- ^ @since 4.7.0.0 +data Proxy t = Proxy deriving ( Bounded -- ^ @since 4.7.0.0 + , Read -- ^ @since 4.7.0.0 ) -- | A concrete, promotable proxy type, for use at the kind level diff --git a/libraries/base/Data/Semigroup.hs b/libraries/base/Data/Semigroup.hs index 4d06a40a6d..4438e2fbe2 100644 --- a/libraries/base/Data/Semigroup.hs +++ b/libraries/base/Data/Semigroup.hs @@ -95,7 +95,15 @@ diff :: Semigroup m => m -> Endo m diff = Endo . (<>) newtype Min a = Min { getMin :: a } - deriving (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1) + deriving ( Bounded -- ^ @since 4.9.0.0 + , Eq -- ^ @since 4.9.0.0 + , Ord -- ^ @since 4.9.0.0 + , Show -- ^ @since 4.9.0.0 + , Read -- ^ @since 4.9.0.0 + , Data -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + ) -- | @since 4.9.0.0 instance Enum a => Enum (Min a) where @@ -158,7 +166,15 @@ instance Num a => Num (Min a) where fromInteger = Min . fromInteger newtype Max a = Max { getMax :: a } - deriving (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1) + deriving ( Bounded -- ^ @since 4.9.0.0 + , Eq -- ^ @since 4.9.0.0 + , Ord -- ^ @since 4.9.0.0 + , Show -- ^ @since 4.9.0.0 + , Read -- ^ @since 4.9.0.0 + , Data -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + ) -- | @since 4.9.0.0 instance Enum a => Enum (Max a) where @@ -222,7 +238,12 @@ instance Num a => Num (Max a) where -- | 'Arg' isn't itself a 'Semigroup' in its own right, but it can be -- placed inside 'Min' and 'Max' to compute an arg min or arg max. data Arg a b = Arg a b deriving - (Show, Read, Data, Generic, Generic1) + ( Show -- ^ @since 4.9.0.0 + , Read -- ^ @since 4.9.0.0 + , Data -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + ) type ArgMin a b = Min (Arg a b) type ArgMax a b = Max (Arg a b) @@ -267,8 +288,16 @@ instance Bitraversable Arg where -- | Use @'Option' ('First' a)@ to get the behavior of -- 'Data.Monoid.First' from "Data.Monoid". -newtype First a = First { getFirst :: a } deriving - (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1) +newtype First a = First { getFirst :: a } + deriving ( Bounded -- ^ @since 4.9.0.0 + , Eq -- ^ @since 4.9.0.0 + , Ord -- ^ @since 4.9.0.0 + , Show -- ^ @since 4.9.0.0 + , Read -- ^ @since 4.9.0.0 + , Data -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + ) -- | @since 4.9.0.0 instance Enum a => Enum (First a) where @@ -317,8 +346,16 @@ instance MonadFix First where -- | Use @'Option' ('Last' a)@ to get the behavior of -- 'Data.Monoid.Last' from "Data.Monoid" -newtype Last a = Last { getLast :: a } deriving - (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1) +newtype Last a = Last { getLast :: a } + deriving ( Bounded -- ^ @since 4.9.0.0 + , Eq -- ^ @since 4.9.0.0 + , Ord -- ^ @since 4.9.0.0 + , Show -- ^ @since 4.9.0.0 + , Read -- ^ @since 4.9.0.0 + , Data -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + ) -- | @since 4.9.0.0 instance Enum a => Enum (Last a) where @@ -371,7 +408,15 @@ instance MonadFix Last where -- __NOTE__: This is not needed anymore since 'Semigroup' became a superclass of -- 'Monoid' in /base-4.11/ and this newtype be deprecated at some point in the future. newtype WrappedMonoid m = WrapMonoid { unwrapMonoid :: m } - deriving (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1) + deriving ( Bounded -- ^ @since 4.9.0.0 + , Eq -- ^ @since 4.9.0.0 + , Ord -- ^ @since 4.9.0.0 + , Show -- ^ @since 4.9.0.0 + , Read -- ^ @since 4.9.0.0 + , Data -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + ) -- | @since 4.9.0.0 instance Monoid m => Semigroup (WrappedMonoid m) where @@ -412,7 +457,14 @@ mtimesDefault n x -- Ideally, this type would not exist at all and we would just fix the -- 'Monoid' instance of 'Maybe' newtype Option a = Option { getOption :: Maybe a } - deriving (Eq, Ord, Show, Read, Data, Generic, Generic1) + deriving ( Eq -- ^ @since 4.9.0.0 + , Ord -- ^ @since 4.9.0.0 + , Show -- ^ @since 4.9.0.0 + , Read -- ^ @since 4.9.0.0 + , Data -- ^ @since 4.9.0.0 + , Generic -- ^ @since 4.9.0.0 + , Generic1 -- ^ @since 4.9.0.0 + ) -- | @since 4.9.0.0 instance Functor Option where diff --git a/libraries/base/Data/Semigroup/Internal.hs b/libraries/base/Data/Semigroup/Internal.hs index 7d163bdc89..7484608c24 100644 --- a/libraries/base/Data/Semigroup/Internal.hs +++ b/libraries/base/Data/Semigroup/Internal.hs @@ -108,7 +108,14 @@ stimesList n x -- >>> getDual (mappend (Dual "Hello") (Dual "World")) -- "WorldHello" newtype Dual a = Dual { getDual :: a } - deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1) + deriving ( Eq -- ^ @since 2.01 + , Ord -- ^ @since 2.01 + , Read -- ^ @since 2.01 + , Show -- ^ @since 2.01 + , Bounded -- ^ @since 2.01 + , Generic -- ^ @since 4.7.0.0 + , Generic1 -- ^ @since 4.7.0.0 + ) -- | @since 4.9.0.0 instance Semigroup a => Semigroup (Dual a) where @@ -138,7 +145,8 @@ instance Monad Dual where -- >>> appEndo computation "Haskell" -- "Hello, Haskell!" newtype Endo a = Endo { appEndo :: a -> a } - deriving (Generic) + deriving ( Generic -- ^ @since 4.7.0.0 + ) -- | @since 4.9.0.0 instance Semigroup (Endo a) where @@ -157,7 +165,13 @@ instance Monoid (Endo a) where -- >>> getAll (mconcat (map (\x -> All (even x)) [2,4,6,7,8])) -- False newtype All = All { getAll :: Bool } - deriving (Eq, Ord, Read, Show, Bounded, Generic) + deriving ( Eq -- ^ @since 2.01 + , Ord -- ^ @since 2.01 + , Read -- ^ @since 2.01 + , Show -- ^ @since 2.01 + , Bounded -- ^ @since 2.01 + , Generic -- ^ @since 4.7.0.0 + ) -- | @since 4.9.0.0 instance Semigroup All where @@ -176,7 +190,13 @@ instance Monoid All where -- >>> getAny (mconcat (map (\x -> Any (even x)) [2,4,6,7,8])) -- True newtype Any = Any { getAny :: Bool } - deriving (Eq, Ord, Read, Show, Bounded, Generic) + deriving ( Eq -- ^ @since 2.01 + , Ord -- ^ @since 2.01 + , Read -- ^ @since 2.01 + , Show -- ^ @since 2.01 + , Bounded -- ^ @since 2.01 + , Generic -- ^ @since 4.7.0.0 + ) -- | @since 4.9.0.0 instance Semigroup Any where @@ -192,7 +212,15 @@ instance Monoid Any where -- >>> getSum (Sum 1 <> Sum 2 <> mempty) -- 3 newtype Sum a = Sum { getSum :: a } - deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1, Num) + deriving ( Eq -- ^ @since 2.01 + , Ord -- ^ @since 2.01 + , Read -- ^ @since 2.01 + , Show -- ^ @since 2.01 + , Bounded -- ^ @since 2.01 + , Generic -- ^ @since 4.7.0.0 + , Generic1 -- ^ @since 4.7.0.0 + , Num -- ^ @since 4.7.0.0 + ) -- | @since 4.9.0.0 instance Num a => Semigroup (Sum a) where @@ -221,7 +249,15 @@ instance Monad Sum where -- >>> getProduct (Product 3 <> Product 4 <> mempty) -- 12 newtype Product a = Product { getProduct :: a } - deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1, Num) + deriving ( Eq -- ^ @since 2.01 + , Ord -- ^ @since 2.01 + , Read -- ^ @since 2.01 + , Show -- ^ @since 2.01 + , Bounded -- ^ @since 2.01 + , Generic -- ^ @since 4.7.0.0 + , Generic1 -- ^ @since 4.7.0.0 + , Num -- ^ @since 4.7.0.0 + ) -- | @since 4.9.0.0 instance Num a => Semigroup (Product a) where @@ -251,8 +287,20 @@ instance Monad Product where -- -- @since 4.8.0.0 newtype Alt f a = Alt {getAlt :: f a} - deriving (Generic, Generic1, Read, Show, Eq, Ord, Num, Enum, - Monad, MonadPlus, Applicative, Alternative, Functor) + deriving ( Generic -- ^ @since 4.8.0.0 + , Generic1 -- ^ @since 4.8.0.0 + , Read -- ^ @since 4.8.0.0 + , Show -- ^ @since 4.8.0.0 + , Eq -- ^ @since 4.8.0.0 + , Ord -- ^ @since 4.8.0.0 + , Num -- ^ @since 4.8.0.0 + , Enum -- ^ @since 4.8.0.0 + , Monad -- ^ @since 4.8.0.0 + , MonadPlus -- ^ @since 4.8.0.0 + , Applicative -- ^ @since 4.8.0.0 + , Alternative -- ^ @since 4.8.0.0 + , Functor -- ^ @since 4.8.0.0 + ) -- | @since 4.9.0.0 instance Alternative f => Semigroup (Alt f a) where diff --git a/libraries/base/Data/String.hs b/libraries/base/Data/String.hs index e9f34a82a9..a7295a2144 100644 --- a/libraries/base/Data/String.hs +++ b/libraries/base/Data/String.hs @@ -88,4 +88,6 @@ instance (a ~ Char) => IsString [a] where -- | @since 4.9.0.0 deriving instance IsString a => IsString (Const a b) + +-- | @since 4.9.0.0 deriving instance IsString a => IsString (Identity a) diff --git a/libraries/base/Data/Traversable.hs b/libraries/base/Data/Traversable.hs index 72d88b6d2c..2a654b7eea 100644 --- a/libraries/base/Data/Traversable.hs +++ b/libraries/base/Data/Traversable.hs @@ -293,6 +293,7 @@ instance Traversable Last where instance Traversable ZipList where traverse f (ZipList x) = ZipList <$> traverse f x +-- | @since 4.9.0.0 deriving instance Traversable Identity -- Instances for GHC.Generics @@ -307,19 +308,46 @@ instance Traversable U1 where sequence _ = pure U1 {-# INLINE sequence #-} +-- | @since 4.9.0.0 deriving instance Traversable V1 + +-- | @since 4.9.0.0 deriving instance Traversable Par1 + +-- | @since 4.9.0.0 deriving instance Traversable f => Traversable (Rec1 f) + +-- | @since 4.9.0.0 deriving instance Traversable (K1 i c) + +-- | @since 4.9.0.0 deriving instance Traversable f => Traversable (M1 i c f) + +-- | @since 4.9.0.0 deriving instance (Traversable f, Traversable g) => Traversable (f :+: g) + +-- | @since 4.9.0.0 deriving instance (Traversable f, Traversable g) => Traversable (f :*: g) + +-- | @since 4.9.0.0 deriving instance (Traversable f, Traversable g) => Traversable (f :.: g) + +-- | @since 4.9.0.0 deriving instance Traversable UAddr + +-- | @since 4.9.0.0 deriving instance Traversable UChar + +-- | @since 4.9.0.0 deriving instance Traversable UDouble + +-- | @since 4.9.0.0 deriving instance Traversable UFloat + +-- | @since 4.9.0.0 deriving instance Traversable UInt + +-- | @since 4.9.0.0 deriving instance Traversable UWord -- general functions diff --git a/libraries/base/Data/Type/Coercion.hs b/libraries/base/Data/Type/Coercion.hs index 2bfd9aeb0c..b757682a62 100644 --- a/libraries/base/Data/Type/Coercion.hs +++ b/libraries/base/Data/Type/Coercion.hs @@ -76,8 +76,13 @@ trans Coercion Coercion = Coercion repr :: (a Eq.:~: b) -> Coercion a b repr Eq.Refl = Coercion +-- | @since 4.7.0.0 deriving instance Eq (Coercion a b) + +-- | @since 4.7.0.0 deriving instance Show (Coercion a b) + +-- | @since 4.7.0.0 deriving instance Ord (Coercion a b) -- | @since 4.7.0.0 diff --git a/libraries/base/Data/Type/Equality.hs b/libraries/base/Data/Type/Equality.hs index a3d2e0ef15..8591499197 100644 --- a/libraries/base/Data/Type/Equality.hs +++ b/libraries/base/Data/Type/Equality.hs @@ -120,8 +120,13 @@ inner Refl = Refl outer :: (f a :~: g b) -> (f :~: g) outer Refl = Refl +-- | @since 4.7.0.0 deriving instance Eq (a :~: b) + +-- | @since 4.7.0.0 deriving instance Show (a :~: b) + +-- | @since 4.7.0.0 deriving instance Ord (a :~: b) -- | @since 4.7.0.0 diff --git a/libraries/base/Data/Version.hs b/libraries/base/Data/Version.hs index 310d7387fb..6fb0169d12 100644 --- a/libraries/base/Data/Version.hs +++ b/libraries/base/Data/Version.hs @@ -94,7 +94,10 @@ data Version = -- The interpretation of the list of tags is entirely dependent -- on the entity that this version applies to. } - deriving (Read,Show,Generic) + deriving ( Read -- ^ @since 2.01 + , Show -- ^ @since 2.01 + , Generic -- ^ @since 4.9.0.0 + ) {-# DEPRECATED versionTags "See GHC ticket #2496" #-} -- TODO. Remove all references to versionTags in GHC 8.0 release. |