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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’m with you in that I really <em>really</em> dislike the term “magic” when it comes to macros.  They aren’t magic and I feel the difficulty people have with them is their own mental blockers thinking they are harder than they are.  Macros are great and are at the heart of what makes Elixir what it is.</p>
<p>However, I do personally dislike the general purpose type stuff.  I actually prefer <code>happy_with</code>’s syntax but I’ve never used it because regular <code>with</code> isn’t bad and I would always rather use the vanilla language.  I also do get annoyed at “having to learn” (macros or functions) different ways of doing things there are already perfectly good answers to.  It’s a <em>death by a thousand cuts</em> scenario for me.  Really, I just really like Elixir how it is <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> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="318426" 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/std-result-a-way-to-standardize-function-returns/61719/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-318426" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="318426"
                     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="318429" data-post-id="318429">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="ImNotAVirus" data-post="6" data-topic="61719">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/imnotavirus/48/14224_2.png" class="avatar"> ImNotAVirus:</div>
<blockquote>
<aside class="quote no-group" data-username="cmo" data-post="2" data-topic="61719">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cmo/48/19618_2.png" class="avatar"> cmo:</div>
<blockquote>
<p>It is <a href="https://hexdocs.pm/elixir/naming-conventions.html#trailing-bang-foo" rel="noopener nofollow ugc">convention </a> that functions/macros ending with a <code>!</code> raise exceptions.</p>
</blockquote>
</aside>
<p>I know, but I couldn’t think of a better name for this macro. If you have, don’t hesitate to suggest <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, the macros <code>ok!/1</code> and <code>err!/1</code> raise during a pattern match, so it’s not that far from convention.</p>
</blockquote>
</aside>
<p><code>ok_tuple</code>, <code>wrap_in_ok</code> <code>ok_wrap</code>, <code>wrap_in_ok_tuple</code>, <code>to_ok_tuple</code>.</p>
<p>Solution 1 is evil, bad, bad, naughty, ugly, eww, yucky.<br>
Solution 3 is to return exception structs, as discussed in <a href="https://forum.elixirforum.com/t/with-statement-else-index/56914" rel="nofollow">the thread</a> you linked, in keathley’s blog post that <span class="mention">@soadpopcan</span> lined and <a href="https://forum.elixirforum.com/t/with-construct-usage-question-variables-in-else/43754" rel="nofollow">this one</a>.  Using this method, you can either ignore the error, raise it or use it.</p>
<p>Your example is still contrived because you either don’t care which error it is or all you’re doing with the error is <code>IO.puts</code>.  All of those <code>User</code> and <code>Country</code> functions must be in your codebase(?), so you could easily write functions that return ok/error tuples if that is what you need.</p>
<p>To me, it feels easier to rewrite a function in a legible way than to introduce a library that does things in an idiomatic-Rust/non-idomatic-Elixir way.  You can’t call your library idiomatic Elixir code if you just wrote it and nobody is using it yet.</p>
<p>As <a class="mention" href="/u/sodapopcan" rel="nofollow">@sodapopcan</a> touched on, pipes are often data transformations, and putting a bunch of conditionals in a pipe makes the control flow difficult to see at a glance.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="318429" 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/std-result-a-way-to-standardize-function-returns/61719/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-318429" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="318429"
                     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="318430" data-post-id="318430">
  <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">
								<aside class="quote no-group" data-username="sodapopcan" data-post="12" data-topic="61719">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sodapopcan/48/34668_2.png" class="avatar"> sodapopcan:</div>
<blockquote>
<p>regular <code>with</code> isn’t bad</p>
</blockquote>
</aside>
<p>It’s not, I love <code>with</code>, I just wish it was better, and thankfully elixir is extensible via macros(and I kinda like Zig’s <a href="https://ziglang.org/documentation/master/#try" rel="noopener nofollow ugc"><code>try</code></a>). I’d love if we didn’t have to wait for those changes to land in the languages themselves or to be added in a library by someone with an important name.</p>
<p>In the context of the OP I think it’s valuable because, well, having a normalized return type <em>is</em> valuable but it has the same side effect as <code>with</code>: it makes you create functions</p>
<p>I have a problem personally with that because there wasn’t a case where this sequence doesn’t happen:</p>
<ol>
<li>A few lines of code exist, and they’re extracted to a private function to make <code>with</code> less painful or avoid credo’s cyclomatic complexity check, or the formatter butchers the code, or <code>with</code> would only handle sparse branching points and you need many nested <code>case</code>s and Credo gets mad at you, or some other “small” issue</li>
<li>Now that the private function exist, that piece of code can be called by other code in the same module</li>
<li>2 or more functions that use those private functions have slightly different use cases, so they start to add <code>opts</code> to it to change the behavior</li>
<li>These functions get used by even more functions ouside the module, which also have different requirements</li>
<li>On top of the many slightly changes in required behavior, they also produce side effects, so now you need to keep track of that too</li>
</ol>
<p>Functions have the side effect of encouraging reuse and that reuse is rarely intentional enough to not cause problems</p>
<p>So while, again, I value value normalization, I don’t think libraries like the OP help a lot in the long term. I have similar gripes with Ecto.Multi vs Repo.transact like <a href="https://forum.elixirforum.com/t/why-is-repo-transact-deemed-valuable/61733/7" rel="nofollow">in the other thread</a>. The common suggestion of “create more functions”(and maybe pipe them) sounds good on paper but it almost always gives me problems and I don’t want all that.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="318430" 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/std-result-a-way-to-standardize-function-returns/61719/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-318430" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="318430"
                     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="318432" data-post-id="318432">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="dorgan" data-post="14" data-topic="61719">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dorgan/48/22107_2.png" class="avatar"> dorgan:</div>
<blockquote>
<p>I’d love if we didn’t have to wait for those changes to land in the languages themselves or to be added in a library by someone with an important name.</p>
</blockquote>
</aside>
<p>Why? Is there some kind of company policy that restricts you defining a DSL/features that are valuable to your business needs?</p>
<p>IMO <code>with</code> beats competition by far. Take a look at how scala deals with their “monoids”, in a for comprehension, it just feels like an afterthought to some feature they couldn’t implement.</p>
<p>The usage of course varies and there is room for abuse, this especially happens from people coming from other ecosystems, however if you use it correctly it is invaluable.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="318432" 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/std-result-a-way-to-standardize-function-returns/61719/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-318432" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="318432"
                     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="318435" data-post-id="318435">
  <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">
								<aside class="quote no-group" data-username="D4no0" data-post="15" data-topic="61719">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/d4no0/48/33624_2.png" class="avatar"> D4no0:</div>
<blockquote>
<p>Why? Is there some kind of company policy that restricts you defining a DSL/features that are valuable to your business needs?</p>
</blockquote>
</aside>
<p>It’s very hard to convince people to adop something or to not thoroughly question the implementation to the point of inaction if you don’t have a well known name or reputation. To be more concrete also in reply of the previous “why heresy?” question, I don’t see it mentioned as often nowadays but people were very reluctant to adop patterns outside of “the blessed way”, so heresy seemed appropriate for something that explores the opposite thing. It was nothing intentional, it just happened. (Also to be fair Jose got a lot of pushback in the proposals to improve <code>for</code>, change is hard)</p>
<aside class="quote no-group" data-username="D4no0" data-post="15" data-topic="61719">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/d4no0/48/33624_2.png" class="avatar"> D4no0:</div>
<blockquote>
<p>with</p>
</blockquote>
</aside>
<p>It does, but again, it could be better. And the best way to find what’s better is to actually try other approaches and try to identify what exactly could be better. I pointed above what I personally think that is. Sometimes you are not “holding it wrong” but it could really be different.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="318435" 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/std-result-a-way-to-standardize-function-returns/61719/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-318435" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="318435"
                     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="318436" data-post-id="318436">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I agree that the “result tuple” is such a widespread convention in Elixir it’s a little puzzling there’s not <em>something</em> built in to help you construct those tuples from raw values. But there have been many libraries created to “help” with the problem but they don’t ever seem to gain widespread traction I believe because it is too easy to just add something to your project to assist with whatever specific flavor of that convention the maintainers want to promote.</p>
<p>I think to move forward on this issue we would need a proposal for a change to the standard lib (Tuple.result?) rather than another lib, which there very well might have been, but I don’t think I’ve seen any.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="318436" 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/std-result-a-way-to-standardize-function-returns/61719/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-318436" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="318436"
                     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="318439" data-post-id="318439">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="dorgan" data-post="16" data-topic="61719">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dorgan/48/22107_2.png" class="avatar"> dorgan:</div>
<blockquote>
<p>It’s very hard to comvince people to adop something or to not thoroughly question the implementation to the point of inaction if you don’t have a well known name or reputation.</p>
</blockquote>
</aside>
<p>It is kinda true, this is our nature as humans, even though I would recommend you to try, you never know.</p>
<p>Delivering the idea correctly is also very important, this is why even though the library from this post might prove useful in other ecosystems, there is a clear lack between idea and practicality in elixir ecosystem.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="318439" 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/std-result-a-way-to-standardize-function-returns/61719/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-318439" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="318439"
                     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="318440" data-post-id="318440">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="tfwright" data-post="17" data-topic="61719">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tfwright/48/20299_2.png" class="avatar"> tfwright:</div>
<blockquote>
<p>I think to move forward on this issue we would need a proposal for a change to the standard lib (Tuple.result?) rather than another lib, which there very well might have been, but I don’t think I’ve seen any.</p>
</blockquote>
</aside>
<p>I think this is a terrible idea. The tuple convention <code>{:ok, response}</code> is a ghetto monad that counts as a pure <strong>data structure</strong>.</p>
<p>When you will start enforcing in the language a convention that functions must return a specific shape of data, you will start to have inconsistent behavior:</p>
<ul>
<li>What if my function doesn’t abide by these rules? Example bang functions.</li>
<li>What if my return response is a more comprehensive data structure? Example: <code>{:ok, response, partial_errors}</code></li>
</ul>
<p>Instead of dealing with that proactively it is better to let the user decide, defensive programming is bad practice that needs to die out.</p>
<p>This however doesn’t mean that you can’t use any kind of linters, specific credo rules or dialyzer configurations that would invlolve your local codebase following some specific rules.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="318440" 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/std-result-a-way-to-standardize-function-returns/61719/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-318440" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="318440"
                     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="318443" data-post-id="318443">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I don’t disagree, and I wouldn’t be surprised if this is how the core team feels as well, but it’s unfortunate that the strength of the convention continually creates the pressure for these various libs to help “standardize” the practice…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="318443" data-batch-url="/posts/batch_likers">
                        3
                      </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/std-result-a-way-to-standardize-function-returns/61719/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-318443" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="318443"
                     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="318450" data-post-id="318450">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="D4no0" data-post="19" data-topic="61719">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/d4no0/48/33624_2.png" class="avatar"> D4no0:</div>
<blockquote>
<p>The tuple convention <code>{:ok, response}</code> is a ghetto monad</p>
</blockquote>
</aside>
<p>lol, ya!  It’s actually someone pointing out on this forum a few years ago that <code>{:ok, response}</code> is a monad is what made me finally understand wtf a monad is.  I had a decent, most-of-the-way understanding already, but it never quite clicked.  I said this recently but I really see Elixir as “elegant yet scrappy” and I <em>love</em> that about it.  I am also a big fan of convention and really dislike codebases that are a mish-mash of styles.  I have a love/hate relationship with reading code and and dealing with a frustrating bug is not when I want to be met with someone’s creative coding around a straightforward problem.</p>
<p><a class="mention" href="/u/dorgan" rel="nofollow">@dorgan</a> there is actually a lot to respond to there since you touch on a few things I find myself thinking about a lot.</p>
<p>Warning: Lots of stream-of-consciousness word vomit ahead… please feel free to skip <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>The easiest to address it that my only problem with <code>with</code> as it is how the formatter handles it.  I wish it would let you just put the <code>do</code> on its own line!  It’s literally the only thing about the formatter I <em>really</em> dislike.</p>
<p>Otherwise, the whole “extracting private functions” thing has been on my mind a lot recently.  I feel that a lot of people coming to Elixir from OO, particularly Ruby, have been burned by the gross overuse of single-use private functions.  I feels that many have the perfectly common human response to revolt by going <em>too</em> much the other direction.  I try and just extract private functions when the meaning starts to get muddled.  I’ve never actually thought too much about how they will get used by other functions in the module and honestly, this is because I don’t much experience working alongside other Elixir developers (only about 8 months-worth).  What I’m getting at is that I really only use <code>with</code> with library functions that have consistent return types or each step is itself a significant local function (or in another module that I own).  If I can’t do that I just don’t use <code>with</code>, although I don’t have any good examples of what that looks like.</p>
<p>Otherwise, I do think it’s great to be able to mold the language around so people can experiment with new ideas.  But for me, it’s not really about big names it’s more whether or not it will ever make it into the language that I would continue to use it.  It’s funny you mention the transact thread because I’ve been following along and, even though Ecto is a library itself and I <em>do</em> find Ecto.Multi a bit clunky at times, it’s so ubiquitous that I’d have a hard time adopting transact in my own projects.  I also actually found myself needing to compose multis in a recent project which was my immediate question when first reading that thread and it got answered without my asking <img src="https://forum.elixirforum.com/images/emoji/apple/sweat_smile.png?v=15" title=":sweat_smile:" class="emoji" alt=":sweat_smile:" loading="lazy" width="20" height="20">  In any event, maybe it’s a little closed-minded of me but I like to keep dependencies lean and I’d much rather pull in libraries that are solving the tough application problems I don’t want to deal with.</p>
<p>One thing I am very interested in is using macros to mold the language into a DSL for your business domain.  From what I understand this was one of the original ideas behind LISP that has never caught on (and I do think I understand why).  To me that would be well worth coming onto a project and learning.  But when teams pull in libraries just to make something “a little more like other functional languages” I find it a bit annoying.  It means I’m going to get used to random little things and then probably miss them when they are gone, ha.  As I said earlier, I really love the scrappy side of Elixir and that a lot of stuff is left up to convention.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="318450" 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/std-result-a-way-to-standardize-function-returns/61719/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-318450" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="318450"
                     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/61719/load_more?page=3">Load more posts (15 remaining)</a>
</div></template></turbo-stream>