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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>As others already mentioned or implied, pipe is syntax sugar, not control flow mechanism. The question is more of how to handle control flow - and it depends what you want to achieve.</p>
<p>Things to consider / think about</p>
<ul>
<li>
<p>Which func should care about control flow? individual func, or top-level “orchestration” func?</p>
</li>
<li>
<p>What’s the required behavior when pattern match failing?</p>
</li>
<li>
<p>Wrap small functions in a larger func (e.g. <code>send_email</code> vs <code>build_recipient</code>, <code>build_email_body</code>, <code>send_email</code>) to make orchestration func focusing on control flow</p>
</li>
<li>
<p>Warp others func as needed (e.g. make it returning ok/error tuple)</p>
</li>
</ul> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="120857" 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/should-one-use-pipes-or-with/21000/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-120857" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="120857"
                     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="120924" data-post-id="120924">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Fl4m3Ph03n1x" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Fl4m3Ph03n1x/120/11709_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Fl4m3Ph03n1x
                    <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="dbern" data-post="10" data-topic="21000" 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/dbern/48/7635_2.png" class="avatar"> dbern:</div>
<blockquote>
<p>I’m not following yet; do you have an example of how you organize data transformations via processes?</p>
</blockquote>
</aside>
<p>Processes are irrelevant for the discussion I want to have. My main objective is to discuss the pros and cons of pipelines and functions based on the examples I have give.</p>
<aside class="quote no-group" data-username="peerreynders" data-post="11" data-topic="21000">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>Break them down into smaller functions? (Sorry, couldn’t resist)</p>
</blockquote>
</aside>
<p>So, instead of having a pipeline with 10 functions, you would have a pipeline with 9 functions, one of them being another pipeline with X functions. This is one of the problems I don’t like with pipelines - it adds useless indirection while still forcing me to multi-clause for <em>every error case</em>.</p>
<p>It’s fine if my neat example has 3 functions, but when you have pipelines of pipelines of pipelines, things get weary very quickly.</p>
<p>As for libraries, I was actually using this one:</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://rop.hexdocs.pm/readme.html">
  <header class="source">

      <a href="https://rop.hexdocs.pm/readme.html" target="_blank" rel="noopener nofollow ugc">rop.hexdocs.pm</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://rop.hexdocs.pm/readme.html" target="_blank" rel="noopener nofollow ugc">ROP - Railway Oriented Programming in Elixir – rop v0.5.3</a></h3>



  </article>

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

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

<p>Which is very nice, however I was met with some resistance from my team because no one is familiar with monads and people usually don’t like to use 3rd party tools when they can do the same with bare Elixir (using pipelines with multiclause functions or with statements).</p>
<p>So here I am, trying to figure out which one is best <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="chulkilee" data-post="12" data-topic="21000">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/48/6207_2.png" class="avatar"> chulkilee:</div>
<blockquote>
<p>As others already mentioned or implied, pipe is syntax sugar,</p>
</blockquote>
</aside>
<p>the pipe operator is a macro, just like <code>with</code>. According to you, both are syntax sugars. I am afraid I am missing the point of your message. Could you elaborate?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="120924" 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/should-one-use-pipes-or-with/21000/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-120924" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="120924"
                     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="120937" data-post-id="120937">
  <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="Fl4m3Ph03n1x" data-post="13" data-topic="21000">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/fl4m3ph03n1x/48/11709_2.png" class="avatar"> Fl4m3Ph03n1x:</div>
<blockquote>
<p>the pipe operator is a macro, just like <code>with</code></p>
</blockquote>
</aside>
<p>The pipe (<code>Kernel.|&gt;/2</code>) is a macro, <code>with</code> (<code>Kernel.SpecialForms.with/1</code>) is only documented to be one. As with every “macro” in <code>Kernel.SpecialForms</code>, it is something understood by the compiler itself. It is one of the basic building blocks of the languages and “expands to itself”. It is treated differently than a macro from anywhere else.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="120937" 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/should-one-use-pipes-or-with/21000/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-120937" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="120937"
                     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="120943" data-post-id="120943">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Fl4m3Ph03n1x" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Fl4m3Ph03n1x/120/11709_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Fl4m3Ph03n1x
                    <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>So, it is a <em>special</em> kind of macro, correct? Or is it something else completely different but it is documented in such a way for users to better understand?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="120943" 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/should-one-use-pipes-or-with/21000/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-120943" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="120943"
                     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="120948" data-post-id="120948">
  <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">
								<p>Basically you can say, that regular macros are syntactic sugar. Even those that are created by third party libraries or yourself. SpecialForms though are actual syntax.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="120948" 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/should-one-use-pipes-or-with/21000/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-120948" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="120948"
                     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="120949" data-post-id="120949">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><code>with</code> can be a true life saver especially when you communicate with other systems, I talk about it <a href="https://youtu.be/ejd8Eqe5760?t=1621" rel="noopener nofollow ugc">here</a>. Basic idea is first validate my own data, then validate with external system(s) then insert locally. Or authentication where things might go wrong at multiple places.</p>
<p><code>|&gt;</code> just shows a transformation of input values to output values to me. I usually don’t expect error handling to take place there but just a smooth transformation.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="120949" 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/should-one-use-pipes-or-with/21000/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-120949" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="120949"
                     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="120981" data-post-id="120981">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Can’t you raise on unexpected errors?</p>
<p>I personally use <code>with</code> when errors are expected, and pipelines with functions that raise when errors should not happen (the boundary is not always obvious):</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def my_fun(url) do
  res =
    url
    |&gt; f1()
    |&gt; HTTPoison.get!()
    |&gt; Jason.decode!()
    |&gt; f2()
    |&gt; f3()

  {:ok, res}
rescue
  %HTTPoison.Error{} -&gt;
    {:error, :http_download_error}

  %Jason.DecodeError{} -&gt;
    {:error, :json_parse_error}

  e -&gt;
    {:error, e}
end
</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="120981" 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/should-one-use-pipes-or-with/21000/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-120981" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="120981"
                     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="121033" data-post-id="121033">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Fl4m3Ph03n1x" data-post="13" data-topic="21000">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/fl4m3ph03n1x/48/11709_2.png" class="avatar"> Fl4m3Ph03n1x:</div>
<blockquote>
<p>So here I am, trying to figure out which one is best <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p>There is no one size fits all … <em>best</em> is highly context sensitive.</p>
<p>Without a library the <a href="https://hexdocs.pm/elixir/Kernel.SpecialForms.html#with/1" rel="noopener nofollow ugc"><code>with/1</code></a> pattern demonstrated by <a class="mention" href="/u/tme_317" rel="nofollow">@tme_317</a> is probably the best <em>starting point</em>.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def something(args) do
  with {:step1, {:ok, result1}} &lt;- {:step1, task1(args)},
       {:step2, {:ok, result2}} &lt;- {:step2, task2(result1)} do
  {:ok, result2}
else
  {_, error} -&gt; error
end
</code></pre>
<p>Granted it isn’t particularly pretty but it gets the job done and there is some flexibility that goes beyond what the pipe can do.</p>
<p>Now I suspect that this has more to do with your own frustration - “why isn’t this already a solved problem within the language itself”.</p>
<p>Likely because this “problem” doesn’t actually come up all <em>that often</em>.</p>
<p>Erlang introduced <code>{:ok, result}/{:error, reason}</code> more than likely as a poor mans <a href="http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Either.html" rel="noopener nofollow ugc"><code>Either</code></a> (or <code>Result</code>) type.</p>
<p>Given how optimized pattern matching is <code>:ok</code>/<code>:error</code> tuples are a <a href="http://dreamsongs.com/WorseIsBetter.html" rel="noopener nofollow ugc">good enough</a> solution.</p>
<p>Putting my <code>C</code> hat on, I can easily imagine an Erlang programmer cringing at the thought of wasting precious function reductions passing an error value around through function calls just to <em>comply</em> with ROP. The attitude would be to drop everything and return the error value promptly - even if it meant a few more lines of code here and there, as long as it benefitted the runtime budget.</p>
<p>The Elixir pipe operator is merely a DevX function application feature that takes the place method chaining in OO languages and is <em>almost</em> as useful as function composition. The pipe operator never meant to take on the <code>:ok</code>/<code>:error</code> tuple issue.</p>
<p>That is really the domain of <code>with/1</code>. But in order to make it useful beyond just plain <code>{:ok, result}/{:error, reason}</code> values it is also more verbose than a pipe. And finally <code>with/1</code> will quit at the first sign of trouble and is capable of soaking up all sorts of sins committed by the functions that it calls.</p>
<aside class="quote no-group" data-username="Fl4m3Ph03n1x" data-post="13" data-topic="21000">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/fl4m3ph03n1x/48/11709_2.png" class="avatar"> Fl4m3Ph03n1x:</div>
<blockquote>
<p>it adds useless indirection</p>
</blockquote>
</aside>
<p>The same argument can be made against factoring a 1000 line function into multiple smaller functions. To me those smaller functions <strong>add value</strong> as long as they are well named and often they tend to make the code more declarative.</p>
<p>I hate trying to figure something like this out:</p>
<pre data-code-wrap="javascript"><code class="lang-javascript">self.addEventListener('activate', event =&gt; {
  console.log('Activating new service worker...');

  const cacheWhitelist = [staticCacheName];

  event.waitUntil(
    caches.keys().then(cacheNames =&gt; {
      return Promise.all(
        cacheNames.map(cacheName =&gt; {
          if (cacheWhitelist.indexOf(cacheName) === -1) {
            return caches.delete(cacheName);
          }
        })
      );
    })
  );
});
</code></pre>
<p>I find this much easier to reason about:</p>
<pre data-code-wrap="javascript"><code class="lang-javascript">// Activate event
const cacheWhiteList = [staticCacheName]
const isObsoleteCache = name =&gt; cacheWhiteList.indexOf(name) === -1
const selectCachesToDelete = cacheNames =&gt; cacheNames.filter(isObsoleteCache)
const deleteNamedCache = name =&gt; self.caches.delete(name)
const deleteCaches = cacheNames =&gt; Promise.all(cacheNames.map(deleteNamedCache))

function activateListener (event) {
  console.log('Activating new service worker...')
  event.waitUntil(
    self.caches.keys().then(
      selectCachesToDelete
    ).then(
      deleteCaches
    )
  )
}

self.addEventListener('install', installListener)
self.addEventListener('fetch', fetchListener)
self.addEventListener('activate', activateListener)
</code></pre>
<blockquote>
<p>… code for which some members in the JS community would probably lynch me for</p>
<ul>
<li><a href="https://forum.elixirforum.com/t/polly-want-a-message-sandi-metz/19861" rel="nofollow"><em>but now I don’t know how everything works</em></a></li>
<li>like that’s the whole point</li>
<li>maximize the ignorance of every function</li>
</ul>
</blockquote>
<p>So when you have a 10 function pipeline (or <code>with/1</code>) then maybe, just maybe that pipe is spanning multiple, distinct transformations that are just begging to be named for the benefit of future maintainers.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="121033" 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/should-one-use-pipes-or-with/21000/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-121033" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="121033"
                     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="121034" data-post-id="121034">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Fl4m3Ph03n1x" data-post="13" data-topic="21000">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/fl4m3ph03n1x/48/11709_2.png" class="avatar"> Fl4m3Ph03n1x:</div>
<blockquote>
<p>the pipe operator is a macro, just like <code>with</code> . According to you, both are syntax sugars. I am afraid I am missing the point of your message. Could you elaborate?</p>
</blockquote>
</aside>
<p>It’s not about using pipe or not. The fundamental question is how to control flow and where the logic should be placed.</p>
<ul>
<li><code>with</code> is good for orchestration func (handling all control flow) calling simple func (returning ok/error tuple, focusing on single job)</li>
<li>pipe operator is good for pipeline funcs that are aware of context.
<ul>
<li>this control flow is delegated to individual func.</li>
</ul>
</li>
</ul>
<p>Note that it’s not all or nothing. For example, you may use pipe for funcs for data transformation or small control flow.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="121034" 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/should-one-use-pipes-or-with/21000/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-121034" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="121034"
                     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="121043" data-post-id="121043">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I try to use <code>with</code> as much as I can and for all other stuff I like <code>sage</code>, <a href="https://hex.pm/packages/sage" class="inline-onebox" rel="nofollow">sage | Hex</a></p>
<p>See the post: <a href="https://medium.com/nebo-15/introducing-sage-a-sagas-pattern-implementation-in-elixir-3ad499f236f6" rel="noopener nofollow ugc">https://medium.com/nebo-15/introducing-sage-a-sagas-pattern-implementation-in-elixir-3ad499f236f6</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="121043" 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/should-one-use-pipes-or-with/21000/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-121043" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="121043"
                     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/21000/load_more?page=3">Load more posts (3 remaining)</a>
</div></template></turbo-stream>