I would like to create a base type in F# which would allow me to simplify creation of other types with predefined constraint ie. limit to non negative integer etc.. I creted the following base type which intends to use static member of a validator type provided as a generic parameter hoping I will be able to refer to its static "Condition" member - unfortunately it seems I cannot refer to the generic ^tf anywhere in the type body, not to mention its static member.
type Constrained<^tf when ^tf:(static member Condition: 'tv->bool)> (value : int) =
static member Create (v) =
match ^tf.Condition v with
| true -> Some ( Constrained(v) )
| _ -> None
I'm new to F# so I'm not sure if what I'm trying to do can be actually achieved in F#...