diff options
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/GHC/Records.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libraries/base/GHC/Records.hs b/libraries/base/GHC/Records.hs index 43c3931e86..3b1a4c2834 100644 --- a/libraries/base/GHC/Records.hs +++ b/libraries/base/GHC/Records.hs @@ -29,6 +29,13 @@ module GHC.Records -- | Constraint representing the fact that the field @x@ belongs to -- the record type @r@ and has field type @a@. This will be solved -- automatically, but manual instances may be provided as well. -class HasField (x :: k) r a | x r -> a where +-- +-- HasField :: forall {k}. k -> * -> * -> Constraint +-- getField :: forall {k} (x::k) r a. HasField x r a => r -> a +-- NB: The {k} means that k is an 'inferred' type variable, and +-- hence not provided in visible type applications. Thus you +-- say getField @"foo" +-- not getField @Symbol @"foo" +class HasField x r a | x r -> a where -- | Selector function to extract the field from the record. getField :: r -> a |