I have the following two types:
type MedicalConditionStore = {
MedicalCondition: MedicalCondition
LastMod: UTCTick
}
type RejectedMedicalConditionStore = {
RejectedMedicalCondition: MedicalCondition
LastMod: UTCTick
}
And I would like to create the following method:
let accumulateConditions medicalConditionsList =
...
Where medicalConditionsList could be either MedicalConditionStore list or a RejectedMedicalConditionStore list
Intuitively, I was thinking to combine Generics with Constraints, but I cannot manage to find the proper syntax to do that. I have tried something like this, but it doesn't work:
let accumulateConditions (medicalConditionsList: ^a list when ^a :(member F: MedicalCondition)) =
...
Or like this:
let accumulateConditions (medicalConditionsList: RejectedMedicalConditionStore list | MedicalConditionStore list) =
...
Anyone has a clue on how to approach this, without creating another discriminated union type over both of them - a situation in which I always need to wrap and unwrap the members from their general type to the specific one and vice versa using pattern matching?
Thank you!