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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>What you are thinking about would be very possible if the elixir compiler emitted a message to hooks when a “def”/“defp” macro gets compiled, containing the finalized ast of the function.  I think it would be safe because in general hooks don’t let you modify the actual code in-flight.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="188423" 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/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-188423" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="188423"
                     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="190138" data-post-id="190138">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/qqwy" rel="nofollow">@Qqwy</a> - You mention that TypeCheck complements some compile-time checks. I know that <a class="mention" href="/u/ityonemo" rel="nofollow">@ityonemo</a> is just at the outset of work on <a href="https://forum.elixirforum.com/t/typechecker-for-elixir/34474" rel="nofollow">Selectrix</a>, but is it accurate that these two projects could also possibly complement each other whereby Typecheck provides runtime checks via macro and also generates typespecs for which Selectrix uses for compile time checks?</p>
<p>I’m already getting great value out of TypeCheck and Selectrix sounds interesting. Is there any opportunity for collaboration between the projects or is that mostly unnecessary or detrimental to each? My hope is that these sorts of concepts end up in core one way or another.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="190138" 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/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-190138" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="190138"
                     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="190139" data-post-id="190139">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>happy to collaborate!  I have some “unusual” ideas about BEAM types that I’ve outlined in <a href="https://github.com/ityonemo/mavis/blob/master/typesystem.md" rel="noopener nofollow ugc">https://github.com/ityonemo/mavis/blob/master/typesystem.md</a>, which is why i’ve broken this out into a separate library, in case my ideas are too crazy.  However, everything will use typespecs at the end, and I’m not even parsing them, I’m pulling them from the module binaries, so it should “just work” with TypeCheck.</p>
<p>It would be very reasonable to use TypeCheck to generate runtime checks (for dev and test) and use Selectrix for compile-time guards.  Selectrix would keep your type logic correct and TypeCheck would keep your type declarations honest.  I believe these are orthogonal concerns and Selectrix “depends” on the fact that the declarations are correct; IIRC TypeCheck won’t tell you AOT that you’re plugging a square peg into a round hole.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="190139" 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/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-190139" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="190139"
                     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="190140" data-post-id="190140">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Cool. Seems like both projects are all-in on leveraging typespecs. As for far future, I was surprised to see that <a href="https://forum.elixirforum.com/t/typechecker-for-elixir/34474/9" rel="nofollow">José does not seem to be too excited about typespecs</a>, but I guess more important to get something working and useful rather than worrying about whether there is any chance at ever getting it into core.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="190140" 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/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-190140" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="190140"
                     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="190141" data-post-id="190141">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I am definitely discovering warts in the erlang typespec system as I go along.  The biggest one is what does it mean when a map requires a type that is a collection (it’s sensible when the type is a singleton, like literal atom or literal number).  I’m still not 100% sure what I want to do in that case.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="190141" 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/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-190141" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="190141"
                     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 #27"></div>
  </section>
</div>
    <div class="postbit" id="191005" data-post-id="191005">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I just created a new Phoenix project, added <code>type_check</code> and always get this error:</p>
<p><code>** (Mix) Could not start application stream_data: could not find application file: stream_data.app</code>. Do I need to setup anything 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="191005" 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/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-191005" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="191005"
                     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="191006" data-post-id="191006">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Qqwy" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Qqwy/120/1349_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Qqwy
                    <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>TypeCheck Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thank you for mentioning!<br>
As a quick fix, try installing <code>:stream_data</code> as extra dependency.</p>
<p>However, I’ll investigate what is going on here because <code>:stream_data</code> is supposed to be an optional dependency so TypeCheck should still work when it is not available. <a href="https://github.com/Qqwy/elixir-type_check/issues/27" rel="noopener nofollow ugc">I made an issue here</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="191006" 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/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-191006" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="191006"
                     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="191012" data-post-id="191012">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Great, thanks! I also noticed that I cannot do something like</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@spec! fun(Ecto.Changeset.t()) :: Ecto.Changeset.t()
</code></pre>
<p>It tells me that <code>function Ecto.Changeset.t/0 is undefined or private</code>. Is this some misunderstanding on my side, a bug or a limitation of TypeCheck?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="191012" 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/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-191012" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="191012"
                     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>
    <div class="postbit" id="191019" data-post-id="191019">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Ecto is an external library and would not have a <code>t</code> function defined. The <code>t</code> type is, by convention, added for your own structs. For example, in a <code>User</code> module you might have the following from the docs:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@type! t :: %User{name: binary, age: integer}
</code></pre>
<p>This can then be used at a callsite as…</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@spec! my_fun(User.t()) :: User.t()
</code></pre>
<p>This allows you to ensure that a received argument is not only a <code>User</code> struct, but also that its name is a binary and age is an integer.</p>
<p>If you didn’t care about requiring those types, this would also work…</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@spec! my_fun(%User{}) :: %User{}
</code></pre>
<p>This tells you that you can do the same with any struct. So in the case of a changeset, you can use…</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@spec! fun(%Ecto.Changeset{}) :: %Ecto.Changeset{}
</code></pre>
<p>As an example, you can even make your own custom types such as this one:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@type! error_changeset() :: {:error, %Ecto.Changeset{}}
</code></pre>
<p>This can be used at the callsite with…</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@spec! fun(%Ecto.Changeset{}) :: error_changeset()
</code></pre>
<p>In practice, I’ve found that I need only a handful of custom types (other than <code>t</code> definitions). The library provides you with most of the builtins you would expect with regular typespecs.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="191019" 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/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-191019" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="191019"
                     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 #31"></div>
  </section>
</div>
    <div class="postbit" id="191038" data-post-id="191038">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Qqwy" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Qqwy/120/1349_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Qqwy
                    <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>TypeCheck Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="zimt28" data-post="31" data-topic="32886">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zimt28/48/9933_2.png" class="avatar"> zimt28:</div>
<blockquote>
<p>Is this some misunderstanding on my side, a bug or a limitation of TypeCheck?</p>
</blockquote>
</aside>
<p>To add to what <a class="mention" href="/u/baldwindavid" rel="nofollow">@baldwindavid</a> already said: It is somewhat of a current limitation of TypeCheck. As TypeCheck does not infer its type from pre-existing already-compiled typespecs (but rather the other way around, building typespecs as well as runtime-checks and property-test-generators from the written signature) it cannot handle types that were written in other libraries/modules that did not use TypeCheck.</p>
<p>At some point in the near future, TypeCheck will implement all remote types that are builtin in the Elixir core libraries themselves (c.f. issue <a href="https://github.com/Qqwy/elixir-type_check/issues/5" rel="noopener nofollow ugc">#5</a>). Besides this, my current idea of making TypeCheck work well with existing libraries that did not use TypeCheck is to allow you to configure a couple of overrides in your application, saying essentially “if you encouter Ecto.Changeset.t(foo), replace it by …”.</p>
<hr>
<p>Until this is implemented, your best bet is to use the strategies that <a class="mention" href="/u/baldwindavid" rel="nofollow">@baldwindavid</a> mentioned above. <a href="https://hexdocs.pm/ecto/Ecto.Changeset.html#t:t/1" rel="noopener nofollow ugc">Since <code>Ecto.Changeset.t</code> is a public type</a>, you might even use <code>%Ecto.Changeset{data: User.t()}</code>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="191038" 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/typecheck-fast-and-flexible-runtime-type-checking-for-your-elixir-projects/32886/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-191038" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="191038"
                     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 #32"></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/32886/load_more?page=4">Load more posts (70 remaining)</a>
</div></template></turbo-stream>