views:

176

answers:

1

In C# one can state that a generic parameter must implement a certain interface like so:

public class Something<T> where T : IComparable
{
    ...
}

How does one specify this in F#?

+8  A: 

Generic constraints use "when" in F#:

type Foo<'a when 'a :> IComparable> = 
  member x.Bla = 0
MichaelGG