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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="matt-savvy" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  matt-savvy
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think the idea is that there’s a lot of mistakes that can be caught/prevented by the type checker without any code changes or type annotations, but at a certain point, it’s going to be on us to clarify our intentions. There’s plenty of places where it makes total sense to compare numbers to atoms or atoms to tuples.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="387752" 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/set-theoretic-typing-and-existing-elixir-type-heirarchy/75121/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-387752" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="387752"
                     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="387753" data-post-id="387753">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="matt-savvy" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  matt-savvy
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Also, I think this is a place where the type checking is still limited to your project and not its dependencies.</p>
<p>A basic example gets you a warning like you would expect:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  def run(x) do
    res = result(x)

    if res &gt; 5 do
      IO.puts("hello")
    end

    x
  end

  defp result(x) when x &lt; 10, do: {:ok, x + 1}
  defp result(_), do: :error

</code></pre>
<pre data-code-wrap="elixir"><code class="lang-elixir">Compiling 1 file (.ex)
    warning: comparison between distinct types found:

        res &gt; 5

    given types:

        dynamic(:error or {:ok, float() or integer()}) &gt; integer()

    where "res" was given the type:

        # type: dynamic(:error or {:ok, float() or integer()})
        # from: lib/some_app.ex:3:9
        res = result(x)

    While Elixir can compare across all types, you are comparing across types which are always disjoint, and the result is either always true or always false

    type warning found at:
    │
  5 │     if res &gt; 5 do
    │            ~
    │
    └─ lib/some_app.ex:5:12: SomeApp.run/1
</code></pre>
<p>With your dependency :</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">  def run(x) do
    Cachex.start_link(:my_cache)
    {:ok, true} = Cachex.put(:my_cache, "my_key", 5)
    res = Cachex.incr(:my_cache, "my_key")

    if res &gt; 5 do
      IO.puts("larger than three")
    end

    x
  end
</code></pre>
<p>No 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="387753" 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/set-theoretic-typing-and-existing-elixir-type-heirarchy/75121/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-387753" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="387753"
                     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="387754" data-post-id="387754">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="matt-savvy" data-post="12" data-topic="75121">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/48.png" class="avatar"> matt-savvy:</div>
<blockquote>
<p>There’s plenty of places where it makes total sense to compare numbers to atoms or atoms to tuples.</p>
</blockquote>
</aside>
<p>Where and why?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="387754" 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/set-theoretic-typing-and-existing-elixir-type-heirarchy/75121/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-387754" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="387754"
                     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="387755" data-post-id="387755">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="matt-savvy" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  matt-savvy
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Being able to use normal <code>sort</code> operations on lists of elements of different types, things like.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(6)&gt; results = [{:ok, 2}, :error, {:ok, 1}, :error, {:ok, 3}]
[{:ok, 2}, :error, {:ok, 1}, :error, {:ok, 3}]
iex(7)&gt; Enum.sort(results)
[:error, :error, {:ok, 1}, {:ok, 2}, {:ok, 3}]
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="387755" 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/set-theoretic-typing-and-existing-elixir-type-heirarchy/75121/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-387755" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="387755"
                     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="387756" data-post-id="387756">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tjchambers" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tjchambers/120/17299_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tjchambers
                    <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><a class="mention" href="/u/matt-savvy" rel="nofollow">@matt-savvy</a> thanks for your time and comments - much appreciated.</p>
<p>Based on what I have seen so far it seems as though this may be a hole in the current type checking - especially given the “disjoint” comment in one of the warnings in your example. I say that with the highest regard for the awesome work on the type checking to date. Kudos to everyone on this effort.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="387756" 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/set-theoretic-typing-and-existing-elixir-type-heirarchy/75121/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-387756" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="387756"
                     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="387761" data-post-id="387761">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Ah, that’s what you mean. Because if not for that use-case then I’d be genuinely puzzled why would people want to compare tuples with integers.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="387761" 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/set-theoretic-typing-and-existing-elixir-type-heirarchy/75121/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-387761" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="387761"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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