Last active
August 29, 2015 14:03
-
-
Save dmitry-a-morozov/afd85a24579163bc0464 to your computer and use it in GitHub Desktop.
F# attach interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
let getComparableUri uri = { | |
new Uri( uri) | |
interface IComparable<string> with | |
member this.CompareTo other = | |
compare (string this) other | |
} | |
let url = "http://news.google.com/" | |
let x = getComparableUri url | |
let x': IComparable<string> = x |> box |> unbox | |
printfn "Result: %i" (x'.CompareTo(url)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment