<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><tt>(Reply from Sebastiaan Joosten)</tt></p>
    <p><tt>I've tried something similar before but ran into a lot of
        cases where verbose intermediate type annotations where
        necessary to resolve double-wrapping ambiguities because the
        monad is abstract in my case:</tt></p>
    <p><tt>xor :: DSL m r => r S -> r S -> m (r S))</tt></p>
    <p><tt>Where r is representation wrapper, m is the associated
        compiler/interpreter, and S is a phantom tag.<br>
      </tt></p>
    <p><br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 2/5/20 10:05 AM, Sebastiaan Joosten
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:C5AF710D-6588-4F88-8736-46321A978E11@gmail.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      Hi Tom,<br class="">
      <div><br class="">
      </div>
      <div>It wasn't entirely clear to me what you're looking for, so
        I'm probably way off here</div>
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">On 5 Feb 2020, at 08:59, Tom Schouten <<a
              href="mailto:tom@zwizwa.be" class=""
              moz-do-not-send="true">tom@zwizwa.be</a>> wrote:</div>
          <br class="Apple-interchange-newline">
          <div class=""><span style="caret-color: rgb(0, 0, 0);
              font-family: Helvetica; font-size: 12px; font-style:
              normal; font-variant-caps: normal; font-weight: normal;
              letter-spacing: normal; text-align: start; text-indent:
              0px; text-transform: none; white-space: normal;
              word-spacing: 0px; -webkit-text-stroke-width: 0px;
              background-color: rgb(255, 255, 255); text-decoration:
              none; float: none; display: inline !important;" class="">asking
              people to give up expressions while they work just fine in
              C or Verilog</span></div>
        </blockquote>
      </div>
      <br class="">
      <div class="">If all you care about is writing hardware
        expressions, how about providing a handful of self-lifting
        operators? Below is an example of what I mean (you'd replace the
        list applicative with your own applicative). I'm freely
        combining pureed and unpureed Booleans in the 'test' example,
        which would presumably be what your EE's write (I've only given
        them a single self-lifting operator, so they're still stuck
        writing pretty boring code). Does this help?</div>
      <div class=""><br class="">
      </div>
      <div class="">Best,</div>
      <div class="">Sebastiaan</div>
      <div class=""><br class="">
      </div>
      <div class="">PS: I'm not replying to haskell-cafe only because my
        mails bounce there due to a technical issue that's entirely on
        my side, feel free to add this back onto the haskell-cafe thread</div>
      <div class=""><br class="">
      </div>
      <div class="">
        <div style="color: rgb(192, 192, 192); background-color: rgb(32, 32, 32); font-family: Menlo, Monaco, "Courier New", monospace; line-height: 18px; white-space: pre;" class=""><div class="">{-# <span style="color: #f78c6c;" class="">LANGUAGE</span> FlexibleInstances, FlexibleContexts, MultiParamTypeClasses #-}</div><div class=""><span style="color: #f78c6c;" class="">class</span> Pureable <span style="color: #337777;" class="">a</span> <span style="color: #337777;" class="">b</span> <span style="color: #f78c6c;" class="">where</span></div><div class="">  <span style="color: #82aaff;" class="">maybePure</span> <span style="color: #f78c6c;" class="">::</span> <span style="color: #337777;" class="">a</span> <span style="color: #f78c6c;" class="">-></span> <span style="color: #337777;" class="">b</span></div><div class=""><span style="color: #f78c6c;" class="">instance</span> Pureable <span style="color: #337777;" class="">a</span> [<span style="color: #337777;" class="">a</span>] <span style="color: #f78c6c;" class="">where</span></div><div class="">  maybePure <span style="color: #c792ea;" class="">=</span> pure</div><div class=""><span style="color: #f78c6c;" class="">instance</span> Pureable [<span style="color: #337777;" class="">a</span>] [<span style="color: #337777;" class="">a</span>] <span style="color: #f78c6c;" class="">where</span></div><div class="">  maybePure <span style="color: #c792ea;" class="">=</span> id</div>
<div class=""><span style="color: #82aaff;" class="">(.&&)</span> <span style="color: #f78c6c;" class="">::</span> (Pureable <span style="color: #337777;" class="">a</span> [Bool], Pureable <span style="color: #337777;" class="">b</span> [Bool])</div><div class="">      <span style="color: #f78c6c;" class="">=></span> <span style="color: #337777;" class="">a</span> <span style="color: #f78c6c;" class="">-></span> <span style="color: #337777;" class="">b</span> <span style="color: #f78c6c;" class="">-></span> [Bool]</div><div class="">a <span style="color: #c792ea;" class="">.&&</span> b <span style="color: #c792ea;" class="">=</span> <span style="color: #82aaff;" class="">(&&)</span> <span style="color: #c792ea;" class=""><$></span> maybePure a <span style="color: #c792ea;" class=""><*></span> maybePure b</div><div style="line-height: 18px;" class="">
<div class=""><span style="color: #82aaff;" class="">test</span> <span style="color: #f78c6c;" class="">::</span> [Bool] <span style="color: #f78c6c;" class="">-></span> [Bool]</div><div class="">test x <span style="color: #c792ea;" class="">=</span> (True <span style="color: #c792ea;" class="">.&&</span> x) <span style="color: #c792ea;" class="">.&&</span> (False <span style="color: #c792ea;" class="">.&&</span> x)</div></div></div>
      </div>
    </blockquote>
  </body>
</html>