1

Trying to get optional parameters working in a module I tried changing the let to member and static member but that yields errors.

Error FS0010 Unexpected keyword 'member' in definition. Expected incomplete structured construct at or before this point or other token.

OK syntax:

module Kingdom =
    let Rule years = ()

Bad syntax

module Kingdom =
    member this.Rule years = ()

Can you not define a member in a module?

Mikael Dúi Bolinder
  • 2,080
  • 2
  • 19
  • 44

1 Answers1

6

As documentation states

Members are features that are part of a type definition [...] F# object types such as records, classes, discriminated unions, interfaces, and structures support members.

That's why you cannot define member in module directly.

Bohdan Stupak
  • 1,455
  • 8
  • 15