Make it possible to customize annotations derived from Haskell names
Clarification and motivation
HasAnnotation
can be derived for a data type and annotations will be generated from constructor names and field names. That's a good default behavior, but sometimes we want annotations to differ from Haskell names. E. g. our Haskell names may have prefixes or there may be a reason to have a specific annotation that is not a valid Haskell name.
Acceptance criteria
There should be a way to generate HasAnnotation
instance which would modify text values stored in annotations. For example, makeLensesFor takes a list of pairs that specifies how to map field names to names of lenses. In aeson
, they have Options data type which allows you to customize generate names. We should do something similar, i. e. instance generation mechanism should be parameterizeable with something (a list, or a function or an ADT) specifying how to generate an annotation from a Haskell name.