Imagine this discriminated union:
type Direction =
| North
| South
| East
| West
Now imagine that I need a type that accepts only tuples (North, South) or (East, West). Perhaps this will describe the routes of trains that run only from north to south or from east to west. (North, East) and (South, West) should be banned, perhaps because trains do not work this way.
This does not work:
type TrainLines =
| North, South
| East, West
Even if this does not work, perhaps you can see what I'm trying to do.
This works, but does not limit the possibilities only (North, South) and (East, West):
type TrainLines = Direction * Direction
Any recommendations would be appreciated.
source
share