A simplified case of what I'm trying to do is given below.
Given this record type:
type Attribute<'TName,'TOther> =
{
Name:'TName
Data:'TOther
}
I want to define an interface with a function which will ignore the second type parameter of the Attribute type, and will operate only on the basis of the first type parameter. As in:
type AttributeMapper =
interface
abstract member atrName<'a> : Attribute<'a, _> -> 'a
end
This gives me:
...: [FS0715] Anonymous type variables are not permitted in this declaration'
If I hoist the type parameter to Interface's type, then the compiler is happy. No problems here:
type AttributeProcessor2<'a> =
interface
abstract member atrName: Attribute<'a, _> -> 'a
end
let atrMapperInstance2 =
{new AttributeProcessor2<_> with
member _.atrName (x:Attribute<string, _>) = x.Name }
I want to understand the difference between the two cases, and why I'm not allowed to use a wildcard in the first case.