在案例类型签名中使用先前的案例
Using prior cases in case type signature
我知道被歧视的工会可以自称,例如
type Tree=
| Node of Tree
| Leaf
但是有什么方法可以在类型签名中引用其他情况吗?以下两个都会引发 "The type 'Year' is not defined" & "The type 'Month' is not defined"
的错误
type Period =
| Year of int
| Month of Year * int
| Day of Month * int
type Period' =
| Year of int
| Month of Period'.Year * int
| Day of Period'.Month * int
是否有某种形式的注释或关键字(类似于 rec
)允许这种用法?
我认为您对什么构成工会案件感到困惑。您不能将联合案例作为类型引用。我认为您正在寻找的是像这样的单例 DU:
type Year = Year of int
type Month = | Month of Year * int
type Day = Month * int
type Period =
| Year of Year
| Month of Month
| Day of Day
我知道被歧视的工会可以自称,例如
type Tree=
| Node of Tree
| Leaf
但是有什么方法可以在类型签名中引用其他情况吗?以下两个都会引发 "The type 'Year' is not defined" & "The type 'Month' is not defined"
的错误type Period =
| Year of int
| Month of Year * int
| Day of Month * int
type Period' =
| Year of int
| Month of Period'.Year * int
| Day of Period'.Month * int
是否有某种形式的注释或关键字(类似于 rec
)允许这种用法?
我认为您对什么构成工会案件感到困惑。您不能将联合案例作为类型引用。我认为您正在寻找的是像这样的单例 DU:
type Year = Year of int
type Month = | Month of Year * int
type Day = Month * int
type Period =
| Year of Year
| Month of Month
| Day of Day