<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>>In Haskell, if using immutable data, this would requiring
doing a data update on every level</p>
<p>I'm not sure what you mean but in either case it doesn't have to
do with immutability. Haskell is lazy, so your updates will only
happen if the field is later accessed. The other fields in the
record will only be updated if they A) change and B) are later
accessed. If you just updated one field of a record the other
fields will still have pointers to the old data.<br>
<br>
Otherwise, I agree with Matt's answer. Lenses handle this problem
nicely :)<br>
</p>
<div class="moz-cite-prefix">On 05/14/2018 07:41 PM, Dennis Raddle
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAKxLvoqDp7wPUv6H9iKks_gkQpG05PcoBK2yYpnET+r8LyZk8g@mail.gmail.com">
<div dir="ltr">
<div>In my current application, I'm really missing the ability
from OO to do things like</div>
<div><br>
</div>
<div>someData.field1.field2 = "foo"</div>
<div><br>
</div>
<div>What's do I mean?<br>
</div>
<div><br>
</div>
<div>- field selectors are scoped so that names don't clash with
each other or global names</div>
<div><br>
</div>
<div>- this way of selecting data can be used both for reading
it, and for updating specific fields of some data deep in a
data hierarchy (In Haskell, if using immutable data, this
would requiring doing a data update on every level). </div>
<div><br>
</div>
<div>Any attempt to do this in Haskell, for me anyway, results
in an explosion of names and a lot of boilerplate code and a
resulting heavy syntax.</div>
<div><br>
</div>
<div>Is there a way of obtaining OO-like concise syntax, perhaps
with Template Haskell?</div>
<div><br>
</div>
<div>Dennis</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
Only members subscribed via the mailman list are allowed to post.</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<br>
<br>
<br>
<strong
style="color:#000;font-family:Helvetica,Arial;font-size:116%;">Vanessa
McHale</strong><br>
<span
style="color:#000;font-family:Helvetica,Arial;font-size:100%;"><span
style="color:#f00">Functional Compiler Engineer |</span>
Chicago, IL</span>
<br>
<br>
<span
style="color:#999;font-family:Helvetica,Arial;font-size:85%;">Website:
<a href="http://iohk.io" style="color:#f00;">www.iohk.io</a></span><br>
<span
style="color:#999;font-family:Helvetica,Arial;font-size:85%;">Twitter:
@vamchale</span><br>
<span
style="color:#999;font-family:Helvetica,Arial;font-size:85%;">PGP
Key ID: 4209B7B5</span><br>
<br>
<a href="http://iohk.io"><img
src="https://static.iohk.io/logo/logo-email.png" alt="Input
Output" height="46" width="200"></a>
<br>
<br>
<a href="https://twitter.com/InputOutputHK"><img
src="https://static.iohk.io/images/ic-tw.png" alt="Twitter"
height="16" width="18"></a>
<a href="https://github.com/input-output-hk"><img
src="https://static.iohk.io/images/ic-gh.png" alt="Github"
height="16" width="21"></a>
<a href="https://www.linkedin.com/company/input-output-global"><img
src="https://static.iohk.io/images/ic-li.png" alt="LinkedIn"
height="16" width="19"></a>
<br>
</div>
</body>
</html>