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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="massimo" data-post="10" data-topic="19143">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/massimo/48/5555_2.png" class="avatar"> massimo:</div>
<blockquote>
<p>They also know quite well <code>R</code> , which is a kinda complex language, they are smart, but too much is different from what they already know.</p>
</blockquote>
</aside>
<p>If they know R, they may know the tidyverse set of libraries and it’s pipe operator <code>%&gt;%</code> so there may be a way “in” there for at least some of this.</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://cran.r-project.org/web/packages/magrittr/vignettes/magrittr.html">
  <header class="source">

      <a href="https://cran.r-project.org/web/packages/magrittr/vignettes/magrittr.html" target="_blank" rel="noopener nofollow ugc">cran.r-project.org</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://cran.r-project.org/web/packages/magrittr/vignettes/magrittr.html" target="_blank" rel="noopener nofollow ugc">Introducing magrittr</a></h3>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110065" 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/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-110065" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110065"
                     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 #11"></div>
  </section>
</div>
    <div class="postbit" id="110175" data-post-id="110175">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="massimo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/massimo/120/5555_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  massimo
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p>Ah, now we’re getting beyond the <a href="http://xyproblem.info/" rel="noopener nofollow ugc">XY Problem </a>.</p>
</blockquote>
<p>Sorry, but no.</p>
<p>Don’t mean to be rude, but as I’ve said few times already, I’ve only asked <strong>how difficult would it be</strong>.<br>
I really wanted to know <em>how hard would it be</em>.</p>
<p>That’s all.</p>
<p>Thanks.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110175" 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/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-110175" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110175"
                     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 #12"></div>
  </section>
</div>
    <div class="postbit" id="110205" data-post-id="110205">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="massimo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/massimo/120/5555_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  massimo
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks to the great Elixir’s  meta programming capabilities I was able to hack together the code below.<br>
It’s just a quick experiment I did for my own amusement, nobody in his right mind should use it <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>I believe that  giving programmers the freedom to extend the language can work in the same way custom keybindings and plugins in modern editors make them “<em>right for your fingers</em>”.</p>
<p>Kudos to the Elixir team for making it so easy and fun to do complex stuff and experiment on new things.</p>
<pre><code>defmodule A do
  def a &lt;~ b do
    {a, b}
  end

  def {a, [m, f]} ~&gt; b do
    apply(m, f, [a, b])
  end

  def {a, f} ~&gt; b when is_binary(f) do
    case f |&gt; String.split(".") |&gt; Enum.reverse() do
      [f] -&gt;
        {a, String.to_atom(f)} ~&gt; b

      [h | t] -&gt;
        f = String.to_atom(h)
        m = String.to_atom("Elixir.#{Enum.reverse(t) |&gt; Enum.join(".")}")
        {a, [m,f]} ~&gt; b
    end
  end

  def {a, f} ~&gt; b when is_function(f) do
    apply(f, [a, b])
  end

  def {a, f} ~&gt; b do
    apply(Kernel, f, [a, b])
  end
end

# it allows you to write
5 &lt;~"Integer.to_string"~&gt; 2
5 &lt;~"rem"~&gt; 3
5 &lt;~:rem~&gt; 3
[a: 1] &lt;~(&amp;Enum.into/2)~&gt; %{} # parenthesis are necessary due to op precedence 
[a: 1] &lt;~[Enum,:into]~&gt; %{}

# or
enum_into = &amp;Enum.into/2
[a: 1] &lt;~enum_into~&gt; %{}

# or, if you fancy ugly stuff
5 &lt;~fn(a,b)-&gt; rem(a,b) end~&gt; 3
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110205" 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/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-110205" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110205"
                     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 #13"></div>
  </section>
</div>
    <div class="postbit" id="110227" data-post-id="110227">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Infix operators are great if you have 3-5 of them, but then you end up with a line of code like</p>
<blockquote>
<p>a = b &lt;=|=&gt; c</p>
</blockquote>
<p>and you think what in the world does that mean.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110227" 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/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-110227" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110227"
                     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 #14"></div>
  </section>
</div>
    <div class="postbit" id="110236" data-post-id="110236">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="massimo" data-post="1" data-topic="19143">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/massimo/48/5555_2.png" class="avatar"> massimo:</div>
<blockquote>
<p>For example</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">rem(5, 3)
</code></pre>
<p>could be written as</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">5 `rem` 3
</code></pre>
</blockquote>
</aside>
<p>I prefer <code>f(x, y, z)</code> over <code>x f y z</code>, thank you.<br>
Pipe is there so you won’t have to write <code>f(g(h(i(x), y), z), aa)</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="110236" 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/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-110236" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110236"
                     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 #15"></div>
  </section>
</div>
    <div class="postbit" id="110275" data-post-id="110275">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="massimo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/massimo/120/5555_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  massimo
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="dwahyudi" data-post="16" data-topic="19143">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dwahyudi/48/347_2.png" class="avatar"> dwahyudi:</div>
<blockquote>
<p>I prefer <code>f(x, y, z)</code> over <code>x f y z</code> , thank you.</p>
</blockquote>
</aside>
<p>nobody’s trying to steal that from you <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"><br>
also operators works with two operands max, I’m sure you would prefer <code>f(x,y)</code> over <code>f(x,y,z,x,w,k,j,t,o,flags_array)</code></p>
<p>I prefer the <code>f(x)</code> syntax as well, still there are situations where i think it could be of some help</p>
<pre><code>row_id = ordinal_name(div(index, cols)) &lt;&gt; "_row"
row_id = (cols |&gt; div(index) |&gt; ordinal_name) &lt;&gt; "_row"
row_id = ordinal_name(index `div` cols) &lt;&gt; "_row"
</code></pre>
<p>I’m not trying to start a war on which way is the better one</p>
<aside class="quote no-group" data-username="dwahyudi" data-post="16" data-topic="19143">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dwahyudi/48/347_2.png" class="avatar"> dwahyudi:</div>
<blockquote>
<p>Pipe is there so you won’t have to write <code>f(g(h(i(x), y), z), aa)</code></p>
</blockquote>
</aside>
<p>let’s try to give functions a meaningful name</p>
<pre><code>line_to(transpose_to(move_to(coords_for(x), y), z), aa)
</code></pre>
<p>could be  written as</p>
<pre><code>coords_for(x) |&gt; move_to(y) |&gt; transpose_to(z) |&gt; line_to(aa)
coords_for(x) `move_to` y  `transpose_to` z `line_to` aa
</code></pre>
<p>The greatest limitation of the infix notation is that it works when the function acts like an operator.<br>
Pipes look better when stacked and are more useful in the general case.</p>
<p>I don’t see myself writing</p>
<pre><code>record `insert_into` database
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110275" 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/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-110275" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110275"
                     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 #16"></div>
  </section>
</div>
    <div class="postbit" id="110277" data-post-id="110277">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="massimo" data-post="17" data-topic="19143">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/massimo/48/5555_2.png" class="avatar"> massimo:</div>
<blockquote>
<pre data-code-wrap="elixir"><code class="lang-elixir">row_id = ordinal_name(div(index, cols)) &lt;&gt; "_row"
row_id = (cols |&gt; div(index) |&gt; ordinal_name) &lt;&gt; "_row"
row_id = ordinal_name(index `div` cols) &lt;&gt; "_row"
</code></pre>
</blockquote>
</aside>
<p>Have you considered this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">id_fragment = div(index, cols) |&gt; ordinal_name()
row_id = "#{id_fragment}_row"
</code></pre>
<p>This is by far the most clear way to write that, plus/minus piping vs. calling in the <code>id_fragment = …</code> line.</p>
<p>When building strings one should try to replace function calls by variables that already have been bound to. Most of the time this makes the effort much more clear.</p>
<p>In most cases, infixing function names and also pre-fixing operators by using <code>``</code> and <code>()</code> in haskell is often disturbing and requires additional brainpower to re-write the expression in the head to be as it would have been naturally written.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110277" data-batch-url="/posts/batch_likers">
                        4
                      </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/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-110277" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110277"
                     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 #17"></div>
  </section>
</div>
    <div class="postbit" id="267139" data-post-id="267139">
  <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 all,</p>
<p>we’re maintaining <code>witchcraft</code> family of libraries in the wake of deprecations of some pre-defined infix operators.</p>
<p>Right now we’ve already removed some infix notation from the Control.Arrow modules, which makes the UX worse. It’s a sad concession to make, but we’re ready to make it.</p>
<p>However, <code>&lt;|&gt;</code> is now deprecated too, making us consider <code>&lt;~&gt;</code> for <code>Alternative</code>. The problem, however, is that we can’t use this new <code>&lt;~&gt;</code> from <code>Alternative</code> in modules that use <code>&lt;~&gt;</code> from other modules because qualified calls to infix functions don’t work:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(3)&gt; alias Kernel, as: K
Kernel
iex(4)&gt; "foo" &lt;&gt; "bar"
"foobar"
iex(5)&gt; "foo" K.&lt;&gt; "bar"
** (SyntaxError) iex:5:7: syntax error before: 'K'
</code></pre>
<p>It would be very sweet if we got facilities to define custom arrows in Elixir. All the code to support it is there already, and it is absolutely needed even for ergonomic Alternative and Applicative.</p>
<p>Consider the following model example:</p>
<p>Given</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def maybeLeft, do: {:left, {}}
def maybeRight, do: {:right, {}}
</code></pre>
<p>applicative-style function that branches depending on eihter:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def nimble(x) do
  (maybeLeft *&gt; pure("fail")) &lt;|&gt; (maybeRight *&gt; pure("success"))
end
</code></pre>
<p>versus</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def nimble(x) do
  or_else(ap_right(maybeLeft, pure("fail"), ap_right(maybeRight, pure("success")))
end
</code></pre>
<p>The first snippet is clean, the second snippet is messy.</p>
<p>In general, when the operators encode <em>branching</em> or <em>multiplying</em> computation, pipe is insufficient.</p>
<p>At least one industrially validated usecase for this functionality is applicative-style combinatorial parsing. There are more, of course, but I think it is a sufficient argument for custom arrows.</p>
<p>Please note that it’s not to say that C+±style operator overloading is a good feature! The difference is that operators “apply right”, “apply left”, “apply” and “or else” are <em>fundamental</em>. Anything that is Applicative has “ap”-operators, and anything that is Alternative has “or else” operator. So it’s not about overloading operators, but rather about showing that some data structure <em>has</em> properties that allow us to use fundamental operators.</p>
<p>I’d like to also add that the argument for “adding ways to do things”, with all due respect, doesn’t hold water. We have macros in Elixir, which means that many peculiar behaviours can be implemented. A classical example of one is “conn” variable appearing out of thin air when we use <code>get</code> or <code>post</code> macro in <code>Plug</code>. Is it good UX? Yes. Is it confusing when one sees it for the first time? Also yes. I had junior devs ask me question “where does <code>conn</code> come from?”.</p>
<p>In concolusion, I think that there are many options in the solution space to enable this, including having a limited amount of infix operators, but allowing to call them in infix notation in a qualified mode (make <code>Kernel.&lt;&gt;</code> callable in the infix way). But I think that it’s rather natural to simply allow Elixir programmers to define their own operators using the following grammar:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">opS = '&lt;' | '&gt;'
opC = '+' | '*' | '&amp;' | '^' | '-' | '~' | '|'
operator = (opS (opS | opC)*) | ((opS | opC)* opS) | (opC opC opC+)
</code></pre>
<p>P.S.</p>
<p>To reiterate the point, compare once again:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">    opS = either(string('&lt;'), string('&gt;'))

    opC =
      either(string('+'), string('*'))
      |&gt; either(string('&amp;'))
      |&gt; either(string('^'))
      |&gt; either(string('-'))
      |&gt; either(string('~'))
      |&gt; either(string('|'))

    operator =
      opS
      |&gt; followed_by(many(either(opS, opC)))
      |&gt; either(many(either(opS, opC)) |&gt; followed_by(opS))
      |&gt; either(opC |&gt; followed_by(opC, some(opC)))
</code></pre>
<p>with</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">opS = string('&lt;') &lt;|&gt; string('&gt;')

opC =
  string('+') &lt;|&gt; string('-') &lt;|&gt; string('&amp;') &lt;|&gt; string('^') &lt;|&gt;
  string('-') &lt;|&gt; string('~') &lt;|&gt; string('|')

operator =
  (opS &lt;*&gt; many(opS &lt;|&gt; opC)) &lt;|&gt;
  (many(opS &lt;|&gt; opC) &lt;*&gt; opS) &lt;|&gt;
  (opC &lt;*&gt; opC &lt;*&gt; some(opC))
</code></pre>
<p>P.P.S.</p>
<p>If this proposal is accepted, we’re more than happy to submit a PR!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="267139" 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/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-267139" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="267139"
                     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 #18"></div>
  </section>
</div>
    <div class="postbit" id="267243" data-post-id="267243">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="rvirding" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/120/1409_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  rvirding
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Erlang</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Won’t that seriously complicate the understanding of other peoples code? And how should/would the formatter handle these things?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="267243" 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/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-267243" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="267243"
                     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 #19"></div>
  </section>
</div>
    <div class="postbit" id="267267" data-post-id="267267">
  <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 no-group" data-username="doma_dev" data-post="19" data-topic="19143">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/doma_dev/48/23600_2.png" class="avatar"> doma_dev:</div>
<blockquote>
<p>At least one industrially validated usecase for this functionality is applicative-style combinatorial parsing. There are more, of course, but I think it is a sufficient argument for custom arrows.</p>
</blockquote>
</aside>
<p>To back this up, Elm makes a special allowance for the custom infix operators used in its applicative-style combinatorial parsing library even when it removed the ability to introduce custom infix operators for libraries generally.</p>
<p>(I’ve been meaning to convert one of my Elm combinatorial parsers to Elixir to see how much  expressiveness and clarity is lost when using its Nimble parser. And to compare speed.)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="267267" 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/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-267267" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="267267"
                     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 #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/19143/load_more?page=3">Load more posts (5 remaining)</a>
</div></template></turbo-stream>