<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    A module signature can contain data types, and the units can contain
    the concrete data types. This allows e.g. a common interface for all
    string packages: <a class="moz-txt-link-freetext" href="https://github.com/haskell-backpack/backpack-str">https://github.com/haskell-backpack/backpack-str</a><br>
    <br>
    As you can see (particularly here:
<a class="moz-txt-link-freetext" href="https://github.com/haskell-backpack/backpack-str/blob/master/str-sig/Str.hsig#L237">https://github.com/haskell-backpack/backpack-str/blob/master/str-sig/Str.hsig#L237</a>),
    one can let the *type* vary in a way that typeclasses do not allow.<br>
    <br>
    <div class="moz-cite-prefix">On 07/18/2018 10:19 PM, Clinton Mead
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFDVgwE8G1=i+sCtsCdjS9XgYG3+kOvWiHXLjOF6786XBfR1Vg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="ltr">Hi All
        <div><br>
        </div>
        <div>I read though Edward Z. Yang's <a
            href="http://blog.ezyang.com/2016/10/try-backpack-ghc-backpack/"
            moz-do-not-send="true">blog post</a> about Backpack but I
          can't understand what it does above and beyond classes and
          instances.</div>
        <div><br>
        </div>
        <div>It seems to me we could just replace a "signature" with a
          "class" and a "unit" with an "instance" and achieve the same
          thing. </div>
        <div><br>
        </div>
        <div>Of course there are issues with orphans instances if we
          don't own either the class or the associated data, but it
          would seem to me that "orphan units" are no less problematic
          than "orphan instances". </div>
        <div><br>
        </div>
        <div>Edward Kmett's <a
href="https://www.reddit.com/r/haskell/comments/8a5w1n/new_package_unpackedcontainers/"
            moz-do-not-send="true">unpacked-containers</a> gets some
          speed improvements using Backpack, but is Backpack just
          optimisation thing, or are there ways you can organise code
          with <span
style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Backpack</span> 
          that you couldn't do without just classes and instances? For
          example, does Backpack solve the issue of packages requiring
          huge dependency lists to implement instances that most of
          their users will not use?</div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div>Clinton</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>
  </body>
</html>