I was faced today with the following DUs declarations:
type Grammar = Definition list
and Definition = Def of string * Expression
and Range =
| Char of
The and
is needed for the definitions of Grammar
and Definition
to compile correctly. The Grammar
type is listed first but depends on the type Definition
which is defined later. In order to compile properly it must be linked with and
which tells the F# compiler the type definitions are dependent / related.
There is no reason for Range
to be declared in such a way and should be declared with type