On Tue, Apr 27, 2021 at 11:23 PM Larry Garfield <la...@garfieldtech.com>
wrote:

The two options to prevent such errors are:
>
> 1. Sealed classes.
> 2. Extend Enums into ADTs.
>

Unless I've misunderstood your example, there is a third option which quite
possibly prevents the error in a nicer, easier to reason about, more
flexible pattern.

class Perhaps extends Maybe implements OperatesOnTheValueInterface { ... }

Reply via email to