On Thu, Mar 14, 2013 at 10:58 PM, Răzvan Rotaru <span dir="ltr"><<a href="mailto:razvan.rotaru@gmail.com" target="_blank">razvan.rotaru@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div><div><div>2/ I decided to keep the attributes in Maps, so basically a textfield would be<br><br>data Textfield = Textfield (Map.Map TextfieldProps String)<br></div></div></div></div></blockquote><div><br></div>
<div>
Is defining data here even necessary? Even newtype seems superfluous. A plain "shorthand" type synonym surely fits the bill?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div><div><div></div>The problem is: how to define TextfieldProps? It should be something like:<br>
<br></div>data TextfieldProps = Id | Label | Value<br><br></div>But then, buttons also have Id's and labels. So following is not accepted anymore:<br><br></div>data ButtonProps = Id | Label | OnClick<br></blockquote>
</div><br>Perhaps<div><br></div><div>data TextfieldProps = TextId | TextLabel | TextValue</div><div>-- and similarly for ButtonProps?</div><div><br></div><div>I confess to not fully understanding the GUI modelling attempted here, which isn't to say that you aren't on the right track.</div>
<div><br></div><div>To help you and help us help you better, one approach known to be successful is to sketch out the code (better yet, the type signatures!) of what you'd like to write, e.g. how are TextfieldProps and ButtonProps used? What functions act on them?</div>
<div><br></div><div><div>-- Kim-Ee</div>
</div>