diff options
Diffstat (limited to 'libraries/ghc-prim/GHC/Magic/Dict.hs')
-rw-r--r-- | libraries/ghc-prim/GHC/Magic/Dict.hs | 18 |
1 files changed, 14 insertions, 4 deletions
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] |