To add some details to answer the pad, the reason your initial version did not work is because the value type assigned by State
should be a discriminative join value of type TeamState
. In your expression:
let portsmouth = { Name = "Portsmouth"; State = points }
... type points
is points
. In the version published by the pad, the CurrentPoints points
expression CurrentPoints points
constructor to create a distinguishable join value representing CurrentPoints
. Another option that gives you a union: Suspended
, which can be used as follows:
let portsmouth = { Name = "Portsmouth"; State = CurrentPoints points } let portsmouth = { Name = "Portsmouth"; State = Suspended }
If you did not use the constructor name, it is not clear how you built the suspended command!
Finally, you can also write everything on one line, but it is not so readable:
let portsmouth = { Name = "Portsmouth" State = CurrentPoints { LeaguePoints = 20; GoalDifference = 3 } }
source share