Extensible, type-safe unions. This package is very new and likely to change.
Basic usage example (language tags ommitted due to https://github.com/haskell/cabal/issues/774)
which prints:
Casting to an unrelated type does not cause errors;
In the above example,showMyUnion contains a String case despite MyUnion not containing
String - superfluous cases are ignored, for the time being.
typesExhausted is NOT a catchall. It is a null case, and using it as a catchall
(or forgetting to provide a certain case, for instance) will result in an error like:
The left-hand parts of the ': (think type-level `(:)`) are the cases that still need to be satisfied.
Trying to lift an incorrect type to a Union will cause an error resembling:
The original use case for this library was code like this (snipped from some record/playback logic):
The `(:\)` type-level operator is for removal from a set, i.e.
startRecording can be applied to a track in any state except the
Recording state.