# Beginner question. Problem with including module

**URL:** <https://forums.fsharp.org/t/beginner-question-problem-with-including-module/1324>\
**Category:** General\
**Tags:** beginners\
**Created:** [June 12, 2020, 7:16pm UTC](https://forums.fsharp.org/t/beginner-question-problem-with-including-module/1324 "2020-06-12T19:16:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![samwise](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/samwise/32/752_2.png) [@samwise](https://forums.fsharp.org/u/samwise)\
**Post date:** [June 12, 2020, 7:16pm UTC](https://forums.fsharp.org/t/beginner-question-problem-with-including-module/1324/1 "2020-06-12T19:16:02Z")

</div>

Hey, sorry in advance if this is the wrong place for this topic.

So I am new to F# and and currently playing around with a toy project. I installed F# with .NET Core and am using the Ionide-Fsharp extension for VS Code. I have also installed the Argu package in order to parse command line options. I would now like to move the functionality for parsing to a separate file rather than my Program.fs file if that makes sense.

My code works as intended if placed in Program.fs as follows:

```auto
module CLI =
    open Argu

    type CliArguments =
    | [<Mandatory; AltCommandLine("-i")>] Instance of string 
    | [<CustomCommandLine("-a", "--all")>] All   
    | [<CustomCommandLine("-v", "--verbose");>] Verbose    
        interface IArgParserTemplate with
            member s.Usage = match s with
                | Instance _ -> "input DIMACS file."
                | All _ -> "exhaustive search?"
                | Verbose _ -> "turn verbose mode on"
       
    let parser = ArgumentParser.Create<CliArguments>(programName = "gadget.exe")

[<EntryPoint>]
let main argv =
    let results = CLI.parser.ParseCommandLine argv
    printfn "Got parse results %A" <| results.GetAllResults()
    0

```

If I try to move this parsing logic to a seperate file CLI.fs, the package Argu is not found within CLI.fs, and the CLI module is not found within Program.fs.

CLI.fs:

```auto
module CLI =

    open Argu

    type CliArguments =
    | [<Mandatory; AltCommandLine("-i")>] Instance of string
    | [<CustomCommandLine("-a", "--all")>] All
    | [<CustomCommandLine("-v", "--verbose");>] Verbose
        interface IArgParserTemplate with
            member s.Usage =
                match s with
                | Instance _ -> "input DIMACS file."
                | All _ -> "exhaustive search?"
                | Verbose _ -> "turn verbose mode on"

    let parser = ArgumentParser.Create<CliArguments>(programName = "gadget.exe")

```

Program.fs:

```auto
[<EntryPoint>]
let main argv =
    let results = CLI.parser.ParseCommandLine argv
    printfn "Got parse results %A" <| results.GetAllResults()
    0

```

Any ideas on how I should go about this? 🙂

---

<div class="post-metadata">

**Author:** ![samwise](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/samwise/32/752_2.png) [@samwise](https://forums.fsharp.org/u/samwise)\
**Post date:** [June 12, 2020, 7:37pm UTC](https://forums.fsharp.org/t/beginner-question-problem-with-including-module/1324/2 "2020-06-12T19:37:49Z")

</div>

OK so turned out I had to add the CLI.fs file to the item group of compiled files in my .fsproj file.

Also, removing the “=” and indentation in CLI.fs was necessary.

CLI.fs:

```auto
module CLI

open Argu

type CliArguments =
| [<Mandatory; AltCommandLine("-i")>] Instance of string
| [<CustomCommandLine("-a", "--all")>] All
| [<CustomCommandLine("-v", "--verbose");>] Verbose
    interface IArgParserTemplate with
        member s.Usage =
            match s with
            | Instance _ -> "input DIMACS file."
            | All _ -> "exhaustive search?"
            | Verbose _ -> "turn verbose mode on"

let parser = ArgumentParser.Create<CliArguments>(programName = "gadget.exe")

```

Program.fs:

```auto
open CLI

[<EntryPoint>]
let main argv =
    let results = CLI.parser.ParseCommandLine argv
    printfn "Got parse results %A" <| results.GetAllResults()
    0

```

---

<div class="post-metadata">

**Author:** ![dlidstrom](https://yyz2.discourse-cdn.com/flex030/user_avatar/forums.fsharp.org/dlidstrom/32/421_2.png) [@dlidstrom](https://forums.fsharp.org/u/dlidstrom)\
**Post date:** [June 14, 2020, 7:02am UTC](https://forums.fsharp.org/t/beginner-question-problem-with-including-module/1324/3 "2020-06-14T07:02:31Z")

</div>

That’s a good start. It is only the last module that can omit the module declaration at the top (I.e. Program). And it’s only nested modules that need to be indented with the equals sign.  
It is also nice that you don’t have any namespace declaration. I think you won’t need that unless you build something that should be shared (I.e. a library you publish). Using only modules is much more concise. Finally, I am also a fan of Argu!
