`OverloadedRecordDot` support
feature request
I've found defining instances like the following to be rather nice on the common occasion where I just want field access without the syntactic noise of `lens`:
```hs
instance HasField "x" (V2 a) a where
getField = (^. lensVL _x)
instance (HasField "x" (f a) a) => HasField "x" (Point f a) a where
getField = getField @"x" . unP
instance HasField "y" (V2 a) a where
getField = (^. lensVL _y)
instance (HasField "y" (f a) a) => HasField "y" (Point f a) a where
getField = getField @"y" . unP
```
Ideally we'd have more general instances like `instance R1 t => HasField "x" (t a) a where getField = (^. lensVL _x)`, but this gives an error: `Illegal instance declaration for ‘HasField "x" (t a) a’: Record data type must be specified.`.
2 条评论