<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Dennis probably means that when in imperative language you'd write<div class=""><br class=""></div><div class="">employee.department.manager.salary += 1000</div><div class=""><br class=""></div><div class="">in vanilla Haskell it would be like</div><div class=""><br class=""></div><div class="">newSalary = employee.department.manager.salary + 1000</div><div class="">newManager = employee.department.manager {salary = newSalary}</div><div class="">newDepartment = employee.department {manager = newManager}</div><div class="">newEmployee = employee {department = newDepartment}</div><div class=""><br class=""></div><div class="">Lazyness have nothing to do with it. This is actually where lenses usually come in, although I'd argue that the data should rather be restructured.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 2018. May 15., at 16:01, Vanessa McHale <<a href="mailto:vanessa.mchale@iohk.io" class="">vanessa.mchale@iohk.io</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">
  
  <div text="#000000" bgcolor="#FFFFFF" class=""><p class="">>In Haskell, if using immutable data, this would requiring
      doing a data update on every level</p><p class="">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 class="">
      <br class="">
      Otherwise, I agree with Matt's answer. Lenses handle this problem
      nicely  :)<br class="">
    </p>
    <div class="moz-cite-prefix">On 05/14/2018 07:41 PM, Dennis Raddle
      wrote:<br class="">
    </div>
    <blockquote type="cite" cite="mid:CAKxLvoqDp7wPUv6H9iKks_gkQpG05PcoBK2yYpnET+r8LyZk8g@mail.gmail.com" class="">
      <div dir="ltr" class="">
        <div class="">In my current application, I'm really missing the ability
          from OO to do things like</div>
        <div class=""><br class="">
        </div>
        <div class="">someData.field1.field2 = "foo"</div>
        <div class=""><br class="">
        </div>
        <div class="">What's do I mean?<br class="">
        </div>
        <div class=""><br class="">
        </div>
        <div class="">- field selectors are scoped so that names don't clash with
          each other or global names</div>
        <div class=""><br class="">
        </div>
        <div class="">- 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 class=""><br class="">
        </div>
        <div class="">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 class=""><br class="">
        </div>
        <div class="">Is there a way of obtaining OO-like concise syntax, perhaps
          with Template Haskell?</div>
        <div class=""><br class="">
        </div>
        <div class="">Dennis</div>
        <div class=""><br class="">
        </div>
      </div>
      <br class="">
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br class="">
      <pre wrap="" class="">_______________________________________________
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 class="">
    <div class="moz-signature">-- <br class="">
      <br class="">
      <br class="">
      <br class="">
      <strong style="font-family: Helvetica, Arial; font-size: 116%;" class="">Vanessa
        McHale</strong><br class="">
      <span style="font-family: Helvetica, Arial; font-size: 100%;" class=""><span style="color:#f00" class="">Functional Compiler Engineer |</span>
        Chicago, IL</span>
      <br class="">
      <br class="">
      <span style="color:#999;font-family:Helvetica,Arial;font-size:85%;" class="">Website:
        <a href="http://iohk.io/" style="color:#f00;" class="">www.iohk.io</a></span><br class="">
      <span style="color:#999;font-family:Helvetica,Arial;font-size:85%;" class="">Twitter:
        @vamchale</span><br class="">
      <span style="color:#999;font-family:Helvetica,Arial;font-size:85%;" class="">PGP
        Key ID: 4209B7B5</span><br class="">
      <br class="">
      <a href="http://iohk.io/" class=""><img src="https://static.iohk.io/logo/logo-email.png" alt="Input
          Output" height="46" width="200" class=""></a>
      <br class="">
      <br class="">
      <a href="https://twitter.com/InputOutputHK" class=""><img src="https://static.iohk.io/images/ic-tw.png" alt="Twitter" height="16" width="18" class=""></a>
      <a href="https://github.com/input-output-hk" class=""><img src="https://static.iohk.io/images/ic-gh.png" alt="Github" height="16" width="21" class=""></a>
      <a href="https://www.linkedin.com/company/input-output-global" class=""><img src="https://static.iohk.io/images/ic-li.png" alt="LinkedIn" height="16" width="19" class=""></a>
      <br class="">
    </div>
  </div>

_______________________________________________<br class="">Haskell-Cafe mailing list<br class="">To (un)subscribe, modify options or view archives go to:<br class=""><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br class="">Only members subscribed via the mailman list are allowed to post.</div></blockquote></div><br class=""></div></body></html>