Is it possible to define a static class that contains overloadable members in F#? let
module bindings cannot be overloaded, even though they are compiled into stati
This is explained in The F# Component Design Guidelines.
[]
type Demo =
static member World = "World"
static member Hello() = Demo.Hello(Demo.World)
static member Hello(name: string) = sprintf "Hello %s!" name
let s1 = Demo.Hello()
let s2 = Demo.Hello("F#")
It is still possible to define instance methods, but you can't instantiate the class when there is no constructor available.
edit Jan 2021 : See the comment from Abel, and the linked issue. Joel Mueller's answer seems to be the best advice so far, but things will perhaps change in the future.