Given a data type like this:<div><br></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<font face="'courier new', monospace">:- type foo ---> foo(bar :: int, baz :: string).</font></blockquote><div><br></div><div>Is there any way to construct a new instance of foo other than this?:</div><div><br>
</div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font face="'courier new', monospace">Foo = foo(10, "eleven").</font></blockquote>
<div><br></div><div>Specifically is there a way to use record syntax so that I can name the fields being given their initial value? I've tried a variety of ways but just can't see any way to do this that the compiler will accept and, while not a problem for a simple record like the above type, it's a bit of a nightmare if you're dealing with a type that has, say, a dozen members. I've had to do stuff that looks like this, only with a lot more lines of code:</div>
<div><br></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<font face="'courier new', monospace">Foo = foo( 10 % bar<br></font><font face="'courier new', monospace"> "eleven" % baz<br></font><font face="'courier new', monospace"> ).</font></blockquote>
<div><div><br></div><div>I find this both very ugly and very error-prone.</div><div><br></div>-- <br>"Perhaps people don't believe this, but throughout all of the discussions of entering China our focus has really been what's best for the Chinese people. It's not been about our revenue or profit or whatnot."<br>
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.<br>
</div>