Suppose I have a project like this:
// Types.fs
namespace App
type Foo =
{
X : int
}
// Foo.fs
module App.Foo
let doubleIt (foo : Foo) =
{
X = foo.X * 2
}
Then I get an error like this:
Types.fs(3,6): error FS0250: A module and a type definition named 'Foo' occur in namespace 'App' in two parts of this assembly
However, if I put everything in one file it works:
// Everything.fs
namespace App
type Foo =
{
X : int
}
module Foo =
let doubleIt (foo : Foo) =
{
X = foo.X * 2
}
But to me these seem like the same thing; and I don't want to organize everything into one big file.
- What's going on here?
- Why can't I put the module into another file?
- What is an idiomatic way to organize this code?
dotnet --version
3.1.403