- Modules are defined according to the degree of compromise with the language.
- Variance annotations are prohibited on both type classes and data structures, they may cause ambiguity.
- ADTs
- Singleton constructors that require variance (like
Maybe.Empty
) can be encoded using Liskov lifting if their scope does not escape thedata
package.
- Singleton constructors that require variance (like
- Hierarchy
- For each trait of the hierarchy, a particular typeclass must appear only once as return type in one hierarchy level (
BH1
,BH2
, ...). - Companion objects should only declare implicit instances for the type classes at the top of a hierarchy.
- For each trait of the hierarchy, a particular typeclass must appear only once as return type in one hierarchy level (