2
基本上,我問爲什麼代碼的下列行不會編譯:使用單位的類型參數和壓倒一切的方法
type IGenericType<'a> =
abstract member MyFunc : 'a -> 'a -> 'a
type Implementer() =
member x.Test()() =() // unit->unit->unit
interface IGenericType<unit> with
member x.MyFunc a b = b // FS0017
// member x.MyFunc()() =() // FS0017
只是好奇,如果有,使這項工作按照預期的方法。我認爲這是實施單位和仿製藥的一個限制。
進出口使用以下解決方法的時刻:
type Nothing =
| Nothing
type Implementer() =
interface IGenericType<Nothing> with
member x.MyFunc a b = b
希望有人能對此行爲帶來一些光。