Reputation: 253
Implement a signature in Fsharp
The Signature: MyLibrary.fsi
namespace myLib
module public MyModule1 =
val addition : p:float -> float
The Implementation: MyLibrary.fs
namespace myLib
module public MyModule1 =
let addition p = p*2.0
The Testing
#load "C:\@@@@@\Projects\MyLibrary.fsi"
#load "C:\@@@@@\Projects\MyLibrary.fs"
open myLib.MyModule1
The error:
C:\@@@@@\Projects\MyLibrary.fsi(1,1): error FS0240: The signature file 'FSI_0015_MyLibrary' does not have a corresponding implementation file. If an implementation file exists then check the 'module' and 'namespace' declarations in the signature and implementation files match.
@@@@@ is the equivalent of my full path
Upvotes: 2
Views: 354
Reputation: 21
The error you are getting is because you are running 2 different load statements. Each load has to be able to complete as a valid statement. If you combine the two statements it should work. You also need to escape the slashes. I did that using the '@' prefix. Here is an example:
#load @"C:\@@@@@\Projects\MyLibrary.fsi" @"C:\@@@@@\Projects\MyLibrary.fs"
open myLib.MyModule1
Upvotes: 1
Reputation: 7411
Hopefully I have understood what you are after. Please let me know if you need sth else?
module public MyModule =
type IMyModule1 =
abstract member addition : double -> double
type MyModule =
interface IMyModule1 with
member this.addition p = p*2.0
Upvotes: 2