You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow overriding the names of type constructors, inspired by this reddit post
Is there an easy way to "tag" a sum type with some additional metadata, e.g. a textual representation, and to be able to use it when writing type class instances? In the example below, I'd like to tag Black and White with the strings "black" and "white" and then use them to simplify writing serialization/deserialization instances:
By introducing a Rename :: Symbol -> Symbol -> Type construct we can reuse the Generically instance from aeson (see also #15)
There are other options for renaming, such as positional renaming based on a list of constructor renamings Renaming :: [Symbol] -> Type where the empty string can be ignored
via Generically (OverridePlayerColor '[ Renaming '[ "black", "white" ]])
The argument of Override _ can also be a list of a polykind [k], so that it an accept [Symbol] directly
via Generically (OverridePlayerColor '[ "black", "white" ])
The first one is not diffcult to implement, requires a change to a single instance
Allow overriding the names of type constructors, inspired by this reddit post
By introducing a
Rename :: Symbol -> Symbol -> Type
construct we can reuse theGenerically
instance from aeson (see also #15)There are other options for renaming, such as positional renaming based on a list of constructor renamings
Renaming :: [Symbol] -> Type
where the empty string can be ignoredThe argument of
Override _
can also be a list of a polykind[k]
, so that it an accept[Symbol]
directlyThe first one is not diffcult to implement, requires a change to a single instance
The text was updated successfully, but these errors were encountered: