For custom generators to work with parameterized types, incoherent
instances must be used internally.
In practice, the resulting behavior is what users want 100% of the time,
so you should forget this option even exists.
Details
The default configuration of generic-random does a decent job if
we trust GHC implements precisely the instance resolution algorithm as
described in the GHC manual:
While that assumption holds in practice, it is overly context-dependent
(to know the context leading to a particular choice, we must replay the
whole resolution algorithm).
In particular, this algorithm may find one solution, but it is not
guaranteed to be unique: the behavior of the program is dependent on
implementation details.
An notable property to consider of an implicit type system (such as type
classes) is coherence: the behavior of the program is stable under
specialization.
This sounds nice on paper, but actually leads to surprising behavior for
generic implementations with parameterized types, such as generic-random.
To address that, the coherence property can be relaxd by users, by
explicitly allowing some custom generators to be chosen incoherently. With
appropriate precautions, it is possible to ensure a weaker property which
nevertheless helps keep type inference predictable: when a solution is
found, it is unique.
(This is assuredly weaker, i.e., is not stable under specialization.)
Constructors
INCOHERENTMatch custom generators incoherently.
COHERENTMatch custom generators coherently by default
(can be manually bypassed with Incoherent).