Skip to content

Instantly share code, notes, and snippets.

@panesofglass
Forked from anonymous/ExtInterface.fs
Created August 29, 2013 17:23
Show Gist options
  • Save panesofglass/6380923 to your computer and use it in GitHub Desktop.
Save panesofglass/6380923 to your computer and use it in GitHub Desktop.
type MyType() =
member x.Stuff = 1
member x.DoStuff() = x.Stuff
type IListLike<'T> =
abstract Enumerate : unit -> seq<'T>
type MyType with
member x.DoMore() = x.DoStuff() + 1 // this works
interface IListLike<int> with // this doesn't: All implemented interfaces should be declared on the initial declaration of the type
member x.Enumerate() = seq { yield 1; yield 2 }
[<EntryPoint>]
let main argv =
let t = new MyType()
printfn "%A" (t.DoMore())
System.Console.ReadKey() |> ignore
0 // return an integer exit code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment