鉴于以下类型
type IDocPartX<'delta, 'pures> =
abstract member ToDelta: 'pures -> 'delta
abstract member ToPure: 'delta -> 'pures
abstract member Validate: 'pures -> Option<'pures>
type InitX<'a>(v:'a) =
member this.Value = v
type Foo<'a> = {value: 'a} with
interface IDocPartX<Foo<int>, Foo<string>> with
member this.ToDelta x = Unchecked.defaultof<_>
member this.ToPure x = Unchecked.defaultof<_>
member this.Validate x = Unchecked.defaultof<_>
这个功能
let inline ValidateInitX(x:InitX<IDocPartX<'d,'p>>) =
let r = x.Value
let d = r :?> 'd
let o =
d
|> r.ToPure
|> r.Validate
match o with
| Some v -> r.ToDelta v |> Init |> Some
| _ -> None
和这个值
let a = InitX {value = 1}
let b = ValidateInitX a
为什么值a
无法识别为InitX<IDocPartX<'a, 'b>>
?