I can't wrap my head around how to have procedural a radioField
, since I have to give each option a name. In my case, I want to load the available options from a database and therefore I can't have them statically named. Does anybody have an idea?
radioField handed [ (LeftHanded, LeftHandField, "Left")
, (RightHanded, RightHandField, "Right")
, (Ambidextrous, AmbiField, "Both")
]
I'm the author of Brick. For what it's worth, the Brick Users e-mail list is a good place to ask questions like this.
To your question, though: since the name type is under your control, you can give your name type a constructor that takes parameters to construct sufficiently unique name values that are relevant to the data for each radio button value. For example, if you load database data and each value of your radio button is associated with some numeric ID, you might just have a name type like:
-- The type of database record IDs
type ID = Int
data Name = ...
| RadioOption ID