<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="267269" data-post-id="267269">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="asianfilm" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/asianfilm/120/36986_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  asianfilm
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-Erlang-Core-Team" data-username="rvirding" data-post="20" data-topic="19143" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/48/1409_2.png" class="avatar"> rvirding:</div>
<blockquote>
<p>Won’t that seriously complicate the understanding of other peoples code? And how should/would the formatter handle these things?</p>
</blockquote>
</aside>
<p>The argument above is that the code will have more (not less) clarity for those coming from Haskell and the expressiveness of its infix operators. A comparison is made to the alien-ness of the Plug macro when first encountered.</p>
<p>One can think of Witchcraft library users as ivory tower kids gentrifying the Elixir neighborhood, or as squatters from Haskell-land. Changes to infix operators has kicked them out without an eviction notice.</p>
<p>Perhaps from Elixir citizens’ perspective they were always being tolerated rather than invited. (99% were unaware they had moved in.) But I think it’s worth making allowances for them, even if there’s only a 1% chance that their code expressiveness bleeds into Elixir proper.</p>
<p>PS: I presume the Elixir formatter currently handles (custom) infix operators. And it sounds like they’re willing to make the pull requests to keep it compatible. I’m not sure if there are other “accommodations” that need be made.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="267269" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-difficult-would-it-be-to-add-the-infix-notation-a-la-haskell/19143/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-267269" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="267269"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #21"></div>
  </section>
</div>
    <div class="postbit" id="267340" data-post-id="267340">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="doma_dev" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/doma_dev/120/23600_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  doma_dev
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Dear Robert,</p>
<blockquote>
<p>Won’t that seriously complicate the understanding of other peoples code?</p>
</blockquote>
<p>we’ve tried to address the first point when we mentioned the C++-style operator overloading and the response to “adding ways to do things” argument.</p>
<p>Custom operators are just symbols, same as a human-readable name. Either way when we’re looking at a function called <code>map</code> without knowing the library from which <code>map</code> comes from, we have to use our experience to guess the semantics. For some it will be obvious that <code>map(%{a: :b}, fn x -&gt; x end)</code> shall return <code>[a: :b]</code>, someone else may expect <code>%{a: :b}</code>.</p>
<p>Would seeing code <code>fn x -&gt; x end &lt;$&gt; %{a: :b}</code> or, in current <code>witchcraft</code> notation <code>%{a: :b} &lt;~ fn x -&gt; x end</code> change anything? I hardly think so.</p>
<p>Note that <em>in absence of operator overloading</em>, the intent to use any infix operator absent from Kernel has to be <em>explicit</em> by the programmer, just as the intent to use any normal function.</p>
<p>To use <code>witchcraft</code>’s <code>&lt;&gt;</code>, we ought to explicitly hide <code>Kernel.&lt;&gt;</code> using <code>import Kernel, except: [&lt;&gt;: 2]</code>.</p>
<blockquote>
<p>And how should/would the formatter handle these things?</p>
</blockquote>
<p>At the end of the day, infix operators are atoms, so as far as we can tell, neither AST, nor pretty-printing facilities shall be affected.</p>
<p>P.S.</p>
<p>I forgot to add <code>$</code> and <code>=</code> to the <code>opC</code> grammar entry. Silly me!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="267340" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-difficult-would-it-be-to-add-the-infix-notation-a-la-haskell/19143/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-267340" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="267340"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #22"></div>
  </section>
</div>
    <div class="postbit" id="267344" data-post-id="267344">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="doma_dev" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/doma_dev/120/23600_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  doma_dev
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I wouldn’t emphasise ivory-towerness. Believe it or not, but in doma.dev we’re all about pragmatism. All we use from <code>witchcraft</code> ecosystem on a day-to-day basis is:</p>
<ul>
<li><code>map</code>.</li>
<li>Algebraic data types as a UX improvement over <code>defstruct</code>.</li>
<li>Typeclasses as a UX improvement over <code>defprotocol</code> / <code>defimpl</code>.</li>
</ul>
<p>On a rare occassion, when we have computations encoded as data (see the “pattern” of building computation and running computation at different sites), we reach for more powerful operators that take data and either spread it over the built computation or threads through a chain of computations.</p>
<p>We’re working on moving the bits that we use frequently and want to <em>actively</em> support into a separate, integrated library. Then we’ll modify some behaviours to be more pragmatic under “offensive programming”, as well as – hopefully – make it play nicer with dialyzer. (We lose time and debugging cycles to the fact that wrapping something of type <code>t0()</code> into an algebraic data type <code>A</code> currently loses the type information about <code>t0()</code>, making the type be <code>A.t()</code>).</p>
<p>However, we would also like to keep helping the original authors of <code>witchcraft</code> maintain compatibility with newer versions of Elixir.</p>
<p>I guess, my point here is that it’s not about Haskell at all. The library family is pragmatic with an added benefit of having powerful tools of execution control beyond what is available OOTB.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="267344" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-difficult-would-it-be-to-add-the-infix-notation-a-la-haskell/19143/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-267344" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="267344"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #23"></div>
  </section>
</div>
    <div class="postbit" id="272851" data-post-id="272851">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="doma_dev" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/doma_dev/120/23600_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  doma_dev
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>We have deprecated arrows and are now enjoying code like this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">map(
  compose(
    compose(&amp;Binary.new!/1, fn x -&gt; x.raw end),
    &amp;B.mk_url!/1
  )
)
</code></pre>
<p>instead of <code>map(&amp;Binary.new!/1 &lt;|&gt; fn x -&gt; x.raw end &lt;|&gt; &amp;B.mk_url!/1)</code>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="272851" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-difficult-would-it-be-to-add-the-infix-notation-a-la-haskell/19143/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-272851" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="272851"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #24"></div>
  </section>
</div>
    <div class="postbit" id="272857" data-post-id="272857">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dorgan" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dorgan/120/22107_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dorgan
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Is that really more clear/expressive than this?</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">fn x -&gt;
  x
  |&gt; Binary.new!()
  |&gt; then(&amp; &amp;1.raw)
  |&gt; B.mk_url!()
end
</code></pre>
<p>or even</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">fn x -&gt;
  binary = Binary.new!(x)
  B.mk_url(binary.raw)
end
</code></pre>
<p>I guess it’s a matter of preference but the only thing valuable I see in your example is <code>map</code> as a more general(as in generic functor map) instead of just <code>Enum.map</code>.</p>
<p>I get the value of a Functor and maybe even Monad or Monoid in your codebase if you enjoy these generalised operations in your codebase, but when it comes to functional composition I find the examples in this thread rather alien and fail to see what’s so pragmatic about it in this language.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="272857" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/how-difficult-would-it-be-to-add-the-infix-notation-a-la-haskell/19143/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-272857" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="272857"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>