Fun with OverloadedRecordDot: Logging

I guess lots of Functor-like types could have a “passthrough” HasField instance as a shorthand for “fmapping with a field accessor”.

Other types can have “extracting a field and massaging its result type into some useable form” instances.

I find HasField instances that “invent” new field names a bit suspect (no big reason really, just my gut feeling) but passthrough instances that transform or obtain some preexisting field are ok I think.

My particular weird HasField instance was on the Optic type from the “optics-core” library, to let me use dot access notation on lenses (Hackage).

3 Likes