Split F# modules across multiple files

前端 未结 5 1913
攒了一身酷
攒了一身酷 2021-01-01 08:51

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#)

5条回答
  •  情书的邮戳
    2021-01-01 09:30

    I sometimes split a type over several places, like this:

    module Foo
    
    type Partial = Bar | BarInt of int
    
    module Bar
    
    type Foo.Partial with
        member x.Extend = 5
    
    
    let b = Foo.Bar.Extend
    

    where modules Foo and Bar are in different files.

提交回复
热议问题