diff options
author | sheaf <sam.derbyshire@gmail.com> | 2022-11-18 15:32:11 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2022-12-13 09:30:47 +0000 |
commit | 8c85afe3248a456dd6de141f1ec0790ef1402cee (patch) | |
tree | 434bf7e3a0de909dcaed13fbf7d88c33f908ff57 /libraries | |
parent | f84d7562201822945216294b6a52c3406f3eae5d (diff) | |
download | haskell-8c85afe3248a456dd6de141f1ec0790ef1402cee.tar.gz |
Fix @since annotations on WithDict and Coercible
Fixes #22453
(cherry picked from commit 68c966cd3c9d581bac4573807e433fe8d063445f)
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/Data/Coerce.hs | 1 | ||||
-rwxr-xr-x | libraries/base/GHC/Exts.hs | 2 | ||||
-rw-r--r-- | libraries/ghc-prim/GHC/Magic/Dict.hs | 18 | ||||
-rw-r--r-- | libraries/ghc-prim/GHC/Types.hs | 2 |
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 f5b2498542..8ef611a27a 100755 --- a/libraries/base/GHC/Exts.hs +++ b/libraries/base/GHC/Exts.hs @@ -120,6 +120,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 34886fee3b..f321801223 100644 --- a/libraries/ghc-prim/GHC/Magic/Dict.hs +++ b/libraries/ghc-prim/GHC/Magic/Dict.hs @@ -33,13 +33,23 @@ module GHC.Magic.Dict (WithDict(..)) where 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 843da4055c..16254cecd9 100644 --- a/libraries/ghc-prim/GHC/Types.hs +++ b/libraries/ghc-prim/GHC/Types.hs @@ -343,7 +343,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 |