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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Crowdhailer" data-post="21" data-topic="3264">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crowdhailer/48/2438_2.png" class="avatar"> Crowdhailer:</div>
<blockquote>
<p>To be honest I wish I could have used yield or return but out of the options I had the others all seamed worse. i.e. else and rescue.</p>
</blockquote>
</aside>
<p>Well, you ‘could’.  ^.^</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">OK.for do
  a &lt;- safe_div(8, 2)
  b &lt;- safe_div(a, 2)
  yield a + b
end
</code></pre>
<p>You’d not be able to use a function named ‘yield’ though, but I think that’s fine.</p>
<p>I’d still just vote for:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">OK.for do
  a &lt;- safe_div(8, 2)
  b &lt;- safe_div(a, 2)
  a + b
end
</code></pre>
<p>It is perfectly and normally elixiry.  <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="47127" 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/ok-elegant-error-handling-with-result-monads-alternative-to-elixir-with-special-form/3264/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-47127" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="47127"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Crowdhailer" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Crowdhailer/120/2438_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Crowdhailer
                      <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 class="user-title">
									<span>Creator of Raxx</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="22" data-topic="3264">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>It is perfectly and normally elixiry.</p>
</blockquote>
</aside>
<p>I certainly don’t disagree with you. I’m going to use it in some code and see how I feel about it. I’m also working on a writer monad for sending messages and am going to see how that looks with the separating after or not</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="49006" 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/ok-elegant-error-handling-with-result-monads-alternative-to-elixir-with-special-form/3264/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-49006" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="49006"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I made a block syntax for monad’y style do expressions in expede’s <code>exceptional</code> library as a PR if you want to see usage (though this one is for different style of error handling, the syntax is the same though):  <a href="https://github.com/expede/exceptional/pull/18" class="inline-onebox" rel="noopener nofollow ugc">Add new syntax, fix credo by OvermindDL1 · Pull Request #18 · expede/exceptional · GitHub</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="49007" 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/ok-elegant-error-handling-with-result-monads-alternative-to-elixir-with-special-form/3264/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-49007" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="49007"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Crowdhailer" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Crowdhailer/120/2438_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Crowdhailer
                      <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 class="user-title">
									<span>Creator of Raxx</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<h3><a name="p-49010-version-190httpshexdocspmok190readmehtmlok-try-released-with-new-oktry-macro-for-normalising-return-values-1" class="anchor" href="#p-49010-version-190httpshexdocspmok190readmehtmlok-try-released-with-new-oktry-macro-for-normalising-return-values-1" aria-label="Heading link" rel="nofollow"></a><a href="https://hexdocs.pm/ok/1.9.0/readme.html#ok-try" rel="noopener nofollow ugc">Version 1.9.0</a> released with new <code>OK.try</code> macro for normalising return values.</h3>
<p>The syntax here is chosen to be basically the same as a natural <code>try</code> block but in this case without any errors being raised.</p>
<h4><a name="p-49010-example-2" class="anchor" href="#p-49010-example-2" aria-label="Heading link" rel="nofollow"></a>Example</h4>
<pre><code>require OK
import Raxx

OK.try do
  user &lt;- fetch_user(1)             # `&lt;-` operator means func returns {:ok, user}
  cart &lt;- fetch_cart(1)             # `&lt;-` again, {:ok, cart}
  order = checkout(cart, user)      # `=` allows pattern matching on non-tagged funcs
  saved_order &lt;- save_order(order)
after
  response(:created)                # Value will be returned unwrapped
rescue
  :user_not_found -&gt;
    response(:not_found)
  :could_not_save -&gt;
    response(:internal_server_error)
end
</code></pre>
<p>This is a very nice way to write code that reliably returns the same type of value.<br>
My favourite feature of this is it is familiar but <code>raise</code> can now be used for exceptions that should never happen.<br>
i.e. programmer errors that should end up in bug tracking software as soon as possible.</p>
<p>With <code>OK.for</code> that was introduced in 1.8.0 I think that these are sane replacements for <code>OK.with</code> which had variable behaviour dependant on which code blocks had been defined.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="49010" 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/ok-elegant-error-handling-with-result-monads-alternative-to-elixir-with-special-form/3264/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-49010" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="49010"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Crowdhailer" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Crowdhailer/120/2438_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Crowdhailer
                      <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 class="user-title">
									<span>Creator of Raxx</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<h3><a name="p-51856-version-191httpshexpmpackagesok191-released-to-fix-warnings-1" class="anchor" href="#p-51856-version-191httpshexpmpackagesok191-released-to-fix-warnings-1" aria-label="Heading link" rel="nofollow"></a><a href="https://hex.pm/packages/ok/1.9.1" rel="nofollow">Version 1.9.1</a> released to fix warnings.</h3>
<p>An warning that could occur when using pipes <code>~&gt;&gt;</code> has been rectified.</p>
<p>The following code now will not raise any errors.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">{:ok, num}
~&gt;&gt; double()
</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="51856" 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/ok-elegant-error-handling-with-result-monads-alternative-to-elixir-with-special-form/3264/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-51856" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="51856"
                     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 #25"></div>
  </section>
</div>
    <div class="postbit" id="58185" data-post-id="58185">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Crowdhailer" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Crowdhailer/120/2438_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Crowdhailer
                      <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 class="user-title">
									<span>Creator of Raxx</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<h3><a name="p-58185-version-193httpshexpmpackagesok193-released-to-deprecate-okwith1-1" class="anchor" href="#p-58185-version-193httpshexpmpackagesok193-released-to-deprecate-okwith1-1" aria-label="Heading link" rel="nofollow"></a><a href="https://hex.pm/packages/ok/1.9.3" rel="nofollow">Version 1.9.3</a> released to deprecate <code>OK.with/1</code></h3>
<p>The general purpose behaviour of <code>OK.with</code> has been replaced with two separate options</p>
<ul>
<li><code>OK.for</code> When a return value should be wrapped as an ok/error tuple</li>
<li><code>OK.try</code> When error handling should be attempted, such as transforming errors to a 500 response.</li>
</ul>
<p>See docs for details: <a href="https://hexdocs.pm/ok/1.9.3/readme.html" class="inline-onebox" rel="noopener nofollow ugc">OK – ok v1.9.3</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="58185" 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/ok-elegant-error-handling-with-result-monads-alternative-to-elixir-with-special-form/3264/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-58185" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="58185"
                     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 #26"></div>
  </section>
</div>
    <div class="postbit" id="81151" data-post-id="81151">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Crowdhailer" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Crowdhailer/120/2438_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Crowdhailer
                      <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 class="user-title">
									<span>Creator of Raxx</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<h3><a name="p-81151-version-1100httpshexpmpackagesok1100-add-map2-and-to-treat-result-tuples-as-functors-1" class="anchor" href="#p-81151-version-1100httpshexpmpackagesok1100-add-map2-and-to-treat-result-tuples-as-functors-1" aria-label="Heading link" rel="nofollow"></a><a href="https://hex.pm/packages/ok/1.10.0" rel="nofollow">Version 1.10.0</a>: Add <code>map/2</code> and <code>~&gt;</code> to treat result tuples as Functors.</h3>
<p>The latest version of ok (<a href="https://hex.pm/packages/ok/1.10.0" rel="nofollow">1.10.0</a>) has been release. It adds functionality to transform a value within an <code>:ok</code> tuple. e.g.</p>
<h4><a name="p-81151-examples-2" class="anchor" href="#p-81151-examples-2" aria-label="Heading link" rel="nofollow"></a>Examples</h4>
<pre><code>iex&gt; {:ok, 5} ~&gt; Integer.to_string
{:ok, "5"}

iex&gt; {:error, :zero_division_error} ~&gt; Integer.to_string
{:error, :zero_division_error}

iex&gt; {:ok, "a,b"} ~&gt; String.split(",")
{:ok, ["a", "b"]}
</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="81151" data-batch-url="/posts/batch_likers">
                        5
                      </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/ok-elegant-error-handling-with-result-monads-alternative-to-elixir-with-special-form/3264/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-81151" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="81151"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
    <div class="postbit" id="83167" data-post-id="83167">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Crowdhailer" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Crowdhailer/120/2438_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Crowdhailer
                      <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 class="user-title">
									<span>Creator of Raxx</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<h3><a name="p-83167-version-1110httpshexpmpackagesok1110-add-map_all2-for-working-through-lists-1" class="anchor" href="#p-83167-version-1110httpshexpmpackagesok1110-add-map_all2-for-working-through-lists-1" aria-label="Heading link" rel="nofollow"></a><a href="https://hex.pm/packages/ok/1.11.0" rel="nofollow">Version 1.11.0</a> Add <code>map_all/2</code> for working through lists.</h3>
<p>Transform every element of a list with a mapping function.<br>
The mapping function must return a result tuple.</p>
<p>If all of the result tuples are tagged :ok, then it returns a list tagged with :ok.<br>
If one or more of the result tuples are tagged :error, it returns the first error.</p>
<h2><a name="p-83167-examples-2" class="anchor" href="#p-83167-examples-2" aria-label="Heading link" rel="nofollow"></a>Examples</h2>
<pre><code>  iex&gt; OK.map_all(1..3, &amp;safe_div(6, &amp;1))
  {:ok, [6.0, 3.0, 2.0]}

  iex&gt; OK.map_all([-1, 0, 1], &amp;safe_div(6, &amp;1))
  {:error, :zero_division}
</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="83167" 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/ok-elegant-error-handling-with-result-monads-alternative-to-elixir-with-special-form/3264/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-83167" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="83167"
                     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 #28"></div>
  </section>
</div>
    <div class="postbit" id="94014" data-post-id="94014">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Crowdhailer" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Crowdhailer/120/2438_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Crowdhailer
                      <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 class="user-title">
									<span>Creator of Raxx</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<h3><a name="p-94014-version-1112httpshexpmpackagesok1112-released-to-fix-dialyzer-warnings-1" class="anchor" href="#p-94014-version-1112httpshexpmpackagesok1112-released-to-fix-dialyzer-warnings-1" aria-label="Heading link" rel="nofollow"></a><a href="https://hex.pm/packages/ok/1.11.2" rel="nofollow">Version 1.11.2</a> released to fix dialyzer warnings.</h3>
<p>Fixes dialyzer warnings</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="94014" 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/ok-elegant-error-handling-with-result-monads-alternative-to-elixir-with-special-form/3264/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-94014" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="94014"
                     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 #29"></div>
  </section>
</div>
    <div class="postbit" id="131647" data-post-id="131647">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Crowdhailer" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Crowdhailer/120/2438_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Crowdhailer
                      <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 class="user-title">
									<span>Creator of Raxx</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<h1><a name="p-131647-ok-220-released-1" class="anchor" href="#p-131647-ok-220-released-1" aria-label="Heading link" rel="nofollow"></a>OK 2.2.0 released</h1>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://hex.pm/packages/ok/2.2.0">
  <header class="source">
      <img src="https://hex.pm/images/hex-full-a8183c4f9adac71516516d107d402b18.svg?vsn=d" class="site-icon" alt="" width="136" height="120">

      <a href="https://hex.pm/packages/ok/2.2.0" target="_blank" rel="noopener nofollow">Hex</a>
  </header>

  <article class="onebox-body">
    <img width="160" height="160" src="https://hex.pm/images/favicon-160-3770bc59f1f8ba7656b4db5a1eacd8e3.png?vsn=d" class="thumbnail onebox-avatar" alt="">

<h3><a href="https://hex.pm/packages/ok/2.2.0" target="_blank" rel="noopener nofollow">ok</a></h3>

  <p>Elegant error/exception handling in Elixir, with result monads.</p>


  </article>

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

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

<h3><a name="p-131647-added-in-22-2" class="anchor" href="#p-131647-added-in-22-2" aria-label="Heading link" rel="nofollow"></a>Added in 2.2</h3>
<p>The functions <code>OK.is_success?/1</code> and <code>OK.is_failure?/1</code>.</p>
<p>Helpful when a series of checks only needs to return a boolean</p>
<h3><a name="p-131647-added-in-21-3" class="anchor" href="#p-131647-added-in-21-3" aria-label="Heading link" rel="nofollow"></a>Added in 2.1</h3>
<p>The function <code>OK.check/3</code> was added</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://ok.hexdocs.pm/2.2.0/OK.html">
  <header class="source">

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

  <article class="onebox-body">
    

<h3><a href="https://ok.hexdocs.pm/2.2.0/OK.html" target="_blank" rel="noopener nofollow ugc">OK – ok v2.3.0</a></h3>



  </article>

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

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

<p>Use it to add extra validation to the value in an OK</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">User
|&gt; Repo.get(user_id)
|&gt; OK.check(fn () -&gt; user.age &gt; 10 end, :too_young_user)
</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="131647" 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/ok-elegant-error-handling-with-result-monads-alternative-to-elixir-with-special-form/3264/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-131647" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="131647"
                     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 #30"></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/3264/load_more?page=4">Load more posts</a>
</div></template></turbo-stream>