I've been trying to follow the guide from MSDN - Constraints (F#) on creating a type within a module which has a generic type constraint of an enum, as follows:
type Mapper<'TEnum when 'TEnum : enum<uint32>>() =
let dict = new Dictionary<'TEnum, string>()
member this.Add (key: 'TEnum) (value: string) =
dict.Add(key, value)
However, I'm getting the error:
The signature and implementation are not compatible because the declaration of the type parameter 'TEnum' requires a constraint of the form 'TEnum : equality
Is there a way to fix this code example so that I'm able to constrain a type to an enum?