Note [Synonyms implement abstract data]
An abstract data type or class can be implemented using a type synonym,
but ONLY if:
1. T, as a standalone occurrence, is a valid type
(T is "curryable"), and
2. T is valid in an instance head.
This gives rise to the following conditions under which we can implement
an abstract data declaration @data T@ using a type synonym @type T tvs = rhs@:
1. The type synonym T is nullary (tvs is null).
2. The rhs must not contain any foralls, quantified types, or type family
applications.
See 'invalidAbsDataSubTypes' which computes a collection of
invalid subtypes.
See also 'HowAbstract' and Note [Skolem abstract data]. References 1
- Skolem abstract data GHC.Core.TyCon
Referenced by 4
- GHC.Tc.Module call site ×3
- Concrete types GHC.Tc.Utils.Concrete