Skip to content

Instantly share code, notes, and snippets.

@ArtemyB
Created November 15, 2018 08:12
Show Gist options
  • Save ArtemyB/8ce1ced372eae6cc4f745490aa27cf88 to your computer and use it in GitHub Desktop.
Save ArtemyB/8ce1ced372eae6cc4f745490aa27cf88 to your computer and use it in GitHub Desktop.
Implementing interface with overloaded method in F#
type IAbcd<'A, 'B> =
abstract member TheMethod : 'A * int -> 'B
abstract member TheMethod : 'A * string -> 'B
type Abcd<'A>() =
member x.TheMethod(a: 'A, i: int) =
printfn "%i" i
member x.TheMethod(a: 'A, s: string) =
printfn "%s" s
interface IAbcd<'A, unit> with
member x.TheMethod(a: 'A, i: int) = x.TheMethod(a, i)
member x.TheMethod(a: 'A, s: string) = x.TheMethod(a, s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment