I'm trying to learn the TypeShape lib and playing with the IShapeMember per the snippet in the readme
type IShapeMember<'DeclaringType, 'Field> = abstract Get : 'DeclaringType -> 'Field abstract Set : 'DeclaringType -> 'Field -> 'DeclaringType
Here is my code in an effort to generalise a 'setter' function
let setMemberValue (value: 'b) (target: 'c) (shp: IShapeMember<'c>) =
shp.Accept { new IMemberVisitor<'c,'c> with
member x.Visit (m: ShapeMember<'c,'b>) = m.Set target value}
But this gives me the compile error: This code is not sufficiently generic. The type variable 'a could not be generalized because it would escape its scope.
(btw, that's not a type on the error, it indeed complains about variable 'a....)
I have tried all manner of Type wrangling but cannot get my head around what I'm doing wrong.