summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-11-18 15:32:11 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-30 09:31:25 -0500
commit68c966cd3c9d581bac4573807e433fe8d063445f (patch)
treec41fc52398d3aa05eeec6f9d86e8f64c6c8a4c32
parentcc25d52e0f65d54c052908c7d91d5946342ab88a (diff)
downloadhaskell-68c966cd3c9d581bac4573807e433fe8d063445f.tar.gz
Fix @since annotations on WithDict and Coercible
Fixes #22453
-rw-r--r--libraries/base/Data/Coerce.hs1
-rwxr-xr-xlibraries/base/GHC/Exts.hs2
-rw-r--r--libraries/ghc-prim/GHC/Magic/Dict.hs18
-rw-r--r--libraries/ghc-prim/GHC/Types.hs2
4 files changed, 18 insertions, 5 deletions
diff --git a/libraries/base/Data/Coerce.hs b/libraries/base/Data/Coerce.hs
index 2cfb4c9208..804143c613 100644
--- a/libraries/base/Data/Coerce.hs
+++ b/libraries/base/Data/Coerce.hs
@@ -21,6 +21,7 @@
module Data.Coerce
( -- * Safe coercions
+ -- @since 4.7.0.0
coerce, Coercible
) where
import GHC.Prim (coerce)
diff --git a/libraries/base/GHC/Exts.hs b/libraries/base/GHC/Exts.hs
index 9114a398e7..da73955cba 100755
--- a/libraries/base/GHC/Exts.hs
+++ b/libraries/base/GHC/Exts.hs
@@ -122,6 +122,8 @@ module GHC.Exts
unsafeCoerce#,
-- ** Casting class dictionaries with single methods
+ --
+ -- @since 4.17.0.0
WithDict(..),
-- * The maximum tuple size
diff --git a/libraries/ghc-prim/GHC/Magic/Dict.hs b/libraries/ghc-prim/GHC/Magic/Dict.hs
index 96820a502c..bfe72ac3e6 100644
--- a/libraries/ghc-prim/GHC/Magic/Dict.hs
+++ b/libraries/ghc-prim/GHC/Magic/Dict.hs
@@ -35,13 +35,23 @@ module GHC.Magic.Dict (
import GHC.Types (RuntimeRep, TYPE)
--- | @'withDict' d f@ provides a way to call a type-class–overloaded function
--- @f@ by applying it to the supplied dictionary @d@.
+-- | The constraint @'WithDict' cls meth@ can be solved when evidence for
+-- the constraint @cls@ can be provided in the form of a dictionary of
+-- type @meth@. This requires @cls@ to be a class constraint whose single
+-- method has type @meth@.
--
--- 'withDict' can only be used if the type class has a single method with no
--- superclasses. For more (important) details on how this works, see
+-- For more (important) details on how this works, see
-- @Note [withDict]@ in "GHC.Tc.Instance.Class" in GHC.
+--
+-- @since 0.9.0
class WithDict cls meth where
+ -- @'withDict' d f@ provides a way to call a type-class–overloaded function
+ -- @f@ by applying it to the supplied dictionary @d@.
+ --
+ -- 'withDict' can only be used if the type class has a single method with no
+ -- superclasses.
+ --
+ -- @since 0.9.0
withDict :: forall {rr :: RuntimeRep} (r :: TYPE rr). meth -> (cls => r) -> r
{- Note [withDict has an ambiguous type]
diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs
index 1ea6bd9baa..8b9d23787b 100644
--- a/libraries/ghc-prim/GHC/Types.hs
+++ b/libraries/ghc-prim/GHC/Types.hs
@@ -350,7 +350,7 @@ infix 4 ~, ~~
-- <http://research.microsoft.com/en-us/um/people/simonpj/papers/ext-f/coercible.pdf Safe Coercions>
-- by Joachim Breitner, Richard A. Eisenberg, Simon Peyton Jones and Stephanie Weirich.
--
--- @since 4.7.0.0
+-- @since 0.4.0
class Coercible (a :: k) (b :: k)
-- See also Note [The equality types story] in GHC.Builtin.Types.Prim