summaryrefslogtreecommitdiff
path: root/libraries/base/Data/Type
diff options
context:
space:
mode:
authorSeraphime Kirkovski <kirkseraph@gmail.com>2016-06-06 12:29:38 +0200
committerBen Gamari <ben@smart-cactus.org>2016-06-06 15:07:18 +0200
commita90085bd45239fffd65c01c24752a9bbcef346f1 (patch)
tree41a85ba36720d8fba0a3296ea7a844dd9fc0042a /libraries/base/Data/Type
parent48e9a1f5521fa3185510d144dd28a87e452ce134 (diff)
downloadhaskell-a90085bd45239fffd65c01c24752a9bbcef346f1.tar.gz
Add @since annotations to base instances
Add @since annotations to instances in `base`. Test Plan: * ./validate # some commets shouldn't break the build * review the annotations for absurdities. Reviewers: ekmett, goldfire, RyanGlScott, austin, hvr, bgamari Reviewed By: RyanGlScott, hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2277 GHC Trac Issues: #11767
Diffstat (limited to 'libraries/base/Data/Type')
-rw-r--r--libraries/base/Data/Type/Coercion.hs5
-rw-r--r--libraries/base/Data/Type/Equality.hs5
2 files changed, 10 insertions, 0 deletions
diff --git a/libraries/base/Data/Type/Coercion.hs b/libraries/base/Data/Type/Coercion.hs
index 00445bc2b9..254bb9aecf 100644
--- a/libraries/base/Data/Type/Coercion.hs
+++ b/libraries/base/Data/Type/Coercion.hs
@@ -72,15 +72,18 @@ deriving instance Eq (Coercion a b)
deriving instance Show (Coercion a b)
deriving instance Ord (Coercion a b)
+-- | @since 4.7.0.0
instance Coercible a b => Read (Coercion a b) where
readsPrec d = readParen (d > 10) (\r -> [(Coercion, s) | ("Coercion",s) <- lex r ])
+-- | @since 4.7.0.0
instance Coercible a b => Enum (Coercion a b) where
toEnum 0 = Coercion
toEnum _ = errorWithoutStackTrace "Data.Type.Coercion.toEnum: bad argument"
fromEnum Coercion = 0
+-- | @since 4.7.0.0
deriving instance Coercible a b => Bounded (Coercion a b)
-- | This class contains types where you can learn the equality of two types
@@ -90,8 +93,10 @@ class TestCoercion f where
-- | Conditionally prove the representational equality of @a@ and @b@.
testCoercion :: f a -> f b -> Maybe (Coercion a b)
+-- | @since 4.7.0.0
instance TestCoercion ((Eq.:~:) a) where
testCoercion Eq.Refl Eq.Refl = Just Coercion
+-- | @since 4.7.0.0
instance TestCoercion (Coercion a) where
testCoercion Coercion Coercion = Just Coercion
diff --git a/libraries/base/Data/Type/Equality.hs b/libraries/base/Data/Type/Equality.hs
index b22b39d921..233020081b 100644
--- a/libraries/base/Data/Type/Equality.hs
+++ b/libraries/base/Data/Type/Equality.hs
@@ -67,6 +67,7 @@ class a ~~ b => (a :: k) ~ (b :: k)
-- necessary because the functional-dependency coverage check looks
-- through superclasses, and (~#) is handled in that check.
+-- | @since 4.9.0.0
instance {-# INCOHERENT #-} a ~~ b => a ~ b
-- See Note [The equality types story] in TysPrim
-- If we have a Wanted (t1 ~ t2), we want to immediately
@@ -122,15 +123,18 @@ deriving instance Eq (a :~: b)
deriving instance Show (a :~: b)
deriving instance Ord (a :~: b)
+-- | @since 4.7.0.0
instance a ~ b => Read (a :~: b) where
readsPrec d = readParen (d > 10) (\r -> [(Refl, s) | ("Refl",s) <- lex r ])
+-- | @since 4.7.0.0
instance a ~ b => Enum (a :~: b) where
toEnum 0 = Refl
toEnum _ = errorWithoutStackTrace "Data.Type.Equality.toEnum: bad argument"
fromEnum Refl = 0
+-- | @since 4.7.0.0
deriving instance a ~ b => Bounded (a :~: b)
-- | This class contains types where you can learn the equality of two types
@@ -140,6 +144,7 @@ class TestEquality f where
-- | Conditionally prove the equality of @a@ and @b@.
testEquality :: f a -> f b -> Maybe (a :~: b)
+-- | @since 4.7.0.0
instance TestEquality ((:~:) a) where
testEquality Refl Refl = Just Refl