Skip to content

Instantly share code, notes, and snippets.

@colinbull
Created May 30, 2012 16:16
Show Gist options
  • Save colinbull/2837354 to your computer and use it in GitHub Desktop.
Save colinbull/2837354 to your computer and use it in GitHub Desktop.
polymor[hic decomposition
type IFoo =
abstract Do : unit -> unit
type Foo1() =
interface IFoo with
member x.Do() = ()
type Foo2() =
interface IFoo with
member x.Do() = ()
let list =
[
Foo1() :> IFoo;
Foo2() :> IFoo;
Foo1() :> IFoo;
Foo2() :> IFoo;
Foo1() :> IFoo;
Foo2() :> IFoo;
]
let result = Seq.groupBy (fun x -> x.GetType().FullName) list |> Seq.map snd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment