Hi,
I have functions handling printfFormat arguments, here is an example:
let singleInsertAction<'a> format =
Utils.formatStringHandler actionSingleInsertBuilder<'a> format
Which I can call as
let s = singleInsertAction<string> "insert into instances(entity_id) VALUES (%d,%d) RETURNING id" 4 5
This works fine if the function with a printfFormat argument is defined in the same file as the call (even if placed in a different module in that same file), but fails when its module is in a different file, with the error
error FS0003: This value is not a function and cannot be applied. [/home/rb/testfs/genericstest/genericstest.fsproj]
I haven’t found a solution to that problem. Does anyone have an explanation of what happens, and how to get it working?
If you want to try it, I put all the code to reproduce it in a public repo (git clone https://gitlab.com/rbauduin/fsharp-printf-typing-problem.git
). Each situation corresponds to a commit.
Here are the links to different versions:
- all functions in one file in the same module module: Commit da962a, works fine
- functions split in modules, but in one file: Commit 41b697, works fine
- same modules but split in multiple files: Commit df31cf, fails with the error above
With the code in the repo, you can easily reproduce the problem with dotnet restore
and dotnet run
.
Thanks in advance