.net – Split F# modules across multiple files


Is it possible to split an F# module across files?

According to the book I have it is, but the book is probably outdated
(Foundations of F#)

Best Solution

Apparently not:

C:\temp\Tim>type 1.fs 2.fs


module Module

let sayHello1 = printfn "Hello, "


module Module

let sayHello2 = printfn "world!"

C:\temp\Tim>fsc 1.fs 2.fs
Microsoft F# Compiler, (c) Microsoft Corporation, All Rights Reserved
F# Version, compiling for .NET Framework Version v2.0.50727

2.fs(2,1): error FS0191: An implementation of the file or module Module has already been given.

Update: the error has changed in F# 4.0, it is now:

error FS0248: Two modules named 'Module' occur in two parts of this assembly

where Module is the fully qualified name of your assembly, including the namespace part.