I have a type family like
type family CountryCodeContext (countryCodePresence :: CountryCodePresence) t where
CountryCodeContext 'WithCountryCode t = t
CountryCodeContext 'MaybeCountryCode t = Maybe t
CountryCodeContext 'NoCountryCode t = ()
where
data CountryCodePresence
= WithCountryCode
| MaybeCountryCode
| NoCountryCode
Is it possible to convince the compiler somehow that Show t => CountryCodeContext countryCodePresence t
? If I try to write it directly I get a Illegal type synonym family application āCountryCodeContext countryCodePresence tā
error message.
Alternatively, is there a standard way to rewrite this code so that defining instances is possible?