You can type constrain x and y as follows.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
type Foo = 

  class

    val num : int

    new (i : int) as this = { num = i }

  end

  with

    member this.Comparer((x:Foo),(y:Foo)) = compare x.num y.num

  end
By on 10/13/2006 7:27 AM ()

Ah, I had been thrown off by the fact that

1
 this.Comparer(x:Foo, y:Foo) 

was a parse error. Thanks!

By on 10/13/2006 7:33 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper