@@ -67,7 +67,7 @@ import GHC.TypeLits (Symbol, ErrorMessage(..), TypeError)
6767-- :}
6868
6969-- |Records that have a field with a given name.
70−class HasField (field :: Symbol) s t a b | s field -> a where
70+class HasField (field :: Symbol) s t a b | s field -> a, s field b -> t where
7171 -- |A lens that focuses on a field with a given name. Compatible with the
7272 -- lens package's 'Control.Lens.Lens' type.
7373 --
@@ -106,7 +106,7 @@ instance -- see Note [Changing type parameters]
106106 , GHasField' field (Rep s) a
107107 , GHasField' field (Rep s') a'
108108 , GHasField field (Rep s) (Rep t) a b
109− , '(t, b) ~ Infer s' a' a p
109+ , '(t, b) ~ Infer s' a' a (PickTv a' b)
110110 ) => HasField field s t a b where
111111
112112 field f s = ravel (repLens . gfield @field) f s
@@ -115,6 +115,9 @@ instance -- see Note [Changing type parameters]
115115instance {-# OVERLAPPING #-} HasField f (Void2 t a) t a b where
116116 field = undefined
117117
118+instance {-# OVERLAPPING #-} HasField f (Void1 a) (Void1 b) a b where
119+ field = undefined
120+
118121type family ErrorUnless (field :: Symbol) (s :: Type) (contains :: Bool) :: Constraint where
119122 ErrorUnless field s 'False
120123 = TypeError