Split F# modules across multiple files

前端 未结 5 1877
攒了一身酷
攒了一身酷 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:42

    On one of my projects the goal was to place file operations Cp and Rm to separate modules, but do not require user to open two namespaces for both tasks.

    open Xake.FileTasks
    ...
    do! Cp "*/*.exe" "deploy/*.exe"
    do! Rm "*/*.exe"
    

    Here're my modules:

    namespace Xake.FileTasks
    
    []
    module RmImpl =
        let Rm filemask target =
    ...
    

    and the other one:

    namespace Xake.FileTasks
    
    []
    module CpImpl =
        let Cp filemask target =
    ...
    

提交回复
热议问题