
24 Nov
2016
24 Nov
'16
2:52 a.m.
Hey all! I'm trying to understand what's going on in GHC.Generics and defining a generic class... I understand that there's a `Selector` class and `selName` function that can get the *name* of a selector, but is there a way to access the selector function itself? The documentation conveniently avoids examples involving records and is otherwise quite barren. So if I have a data type like... data Person = Person { name :: String , age :: Int } deriving Generic instance MyTypeClass Person I want my generic implementation of MyTypeClass to be able to access each selector function in the record, f :: Person -> String, g :: Person -> Int, etc. Chris