1

次のコードで、F Sharp は次のように述べています。モジュール xyz には値が必要ですnew : (IBlah<'a> * 'b) -> test<'a, 'b>')

その正確なコンストラクターを明示的な new として提供しようとしましたが、タイプは同じでしたが、Intellisense は役に立たなかったようです。どういうわけか制約が間違っていると思います。コードがコンパイルされるように(制約を削除せずに)何を変更すればよいか教えてください。どうもありがとう。

最初に fsi ファイル:

module xyz

type IBlah<'a> =
    abstract something : 'a -> 'a

type IHuha =
    abstract something : unit -> unit

type test<'a, 'b when 'a :> IHuha and 'b : comparison> =
    new : (IBlah<'a> * 'b) -> test<'a, 'b>
    member huha : unit -> unit

fs ファイルは次のとおりです。

module xyz

type IBlah<'a> =
    abstract something : 'a -> 'a

type IHuha =
    abstract something : unit -> unit

type test<'a, 'b when 'a :> IHuha and 'b : comparison> (x:IBlah<'a>, y:'b) =

    member x.huha () = printf "%O" x
4

1 に答える 1