On the following code, F sharp says: module xyz requires a value new : (IBlah<'a> * 'b) -> test<'a, 'b>')
I have tried supplying that exact constructor as an explicit new but it did not seem to help, though Intellisense though the type was the same. I expect I have somehow got the constraints wrong. Could someone please tell me what to change so the code compiles (without removing the constraints)? Many thanks.
First the fsi file:
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
The fs file is:
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
The problem is the signature file is describing a constructor which takes a single value of type tuple
(IBlah<'a> * 'b)
The actual constructor though takes 2 values of type IBlah<'a>
and 'b
. Speculating that the .fs implementation is the one you want. If so then just remove the extra parens from the .fsi file
new : IBlah<'a> * 'b -> test<'a, 'b>