<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="226536" data-post-id="226536">
  <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>It was long overdue:<br>
<strong>Version 0.4.0 has been released!</strong> <img src="https://forum.elixirforum.com/images/emoji/apple/cake.png?v=15" title=":cake:" class="emoji" alt=":cake:" loading="lazy" width="20" height="20"></p>
<p>This adds two main features:</p>
<ul>
<li>Protocol-based types</li>
<li>Type overrides.</li>
</ul>
<h2><a name="p-226536-protocol-based-types-1" class="anchor" href="#p-226536-protocol-based-types-1" aria-label="Heading link" rel="nofollow"></a>Protocol-based types</h2>
<p>This adds supports for <code>impl(ProtocolName)</code>. This is a way to use “any type that implements protocol <code>ProtocolName</code>” in your types and specs.</p>
<p>TypeCheck supports this both in type-checks (checking whether a protocol is implemented for the given term), as well as for property-testing generation (generating “any value of any type that implements <code>ProtocolName</code>”):</p>
<p>An example of using protocols in specs:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule OverrideExample do
  use TypeCheck

  @spec! average(impl(Enumerable)) :: {:ok, float()} | {:error, :empty}
  def average(enumerable) do
    if Enum.empty?(enumerable) do
      {:error, :empty}
    else
      res = Enum.sum(enumerable) / Enum.count(enumerable)
      {:ok, res}
    end
  end
end
</code></pre>
<pre data-code-wrap="elixir"><code class="lang-elixir">OverrideExample.average([10, 20])
{:ok, 15.0}
iex(18)&gt; OverrideExample.average(MapSet.new([1,2,3,4]))
{:ok, 2.5}
OverrideExample.average([])              
{:error, :empty}

OverrideExample.average(10)                   
** (TypeCheck.TypeError) At iex:11:
The call to `average/1` failed,
because parameter no. 1 does not adhere to the spec `impl(Enumerable)`.
Rather, its value is: `10`.
Details:
  The call `average(10)`
  does not adhere to spec `average(impl(Enumerable)) :: {:ok, float()} | {:error, :empty}`. Reason:
    parameter no. 1:
      `10` does not implement the protocol `Elixir.Enumerable`
    lib/type_check/spec.ex:156: OverrideExample.average/1
</code></pre>
<p>And an example of some generating some data:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex&gt; require TypeCheck.Type
iex&gt; import TypeCheck.Builtin
iex&gt; TypeCheck.Type.build(impl(Enumerable)) |&gt; TypeCheck.Protocols.ToStreamData.to_gen |&gt; Enum.take(5) 
[
  %{{false, ""} =&gt; -1.0},
  #MapSet&lt;[]&gt;,
  -2..2,
  0..3,
  %{:EG =&gt; {}, {false} =&gt; 1.0, [] =&gt; %{-1 =&gt; ""}}
]
</code></pre>
<h2><a name="p-226536-type-overrides-2" class="anchor" href="#p-226536-type-overrides-2" aria-label="Heading link" rel="nofollow"></a>Type Overrides</h2>
<p>From time to time we need to interface with modules written in other libraries (or the Elixir standard library) which do not expose their types through TypeCheck yet.<br>
We want to be able to use those types in our checks, but they exist in modules that we cannot change ourselves.</p>
<p>The solution is to allow a list of ‘type overrides’ to be given as part of the options passed to <code>use TypeCheck</code>, which allow you to use the original type in your types and documentation, but have it be checked (and potentially property-generated) as the given TypeCheck-type.</p>
<p>An example:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">      defmodule Original do
        @type t() :: any()
      end

      defmodule Replacement do
        use TypeCheck
        @type! t() :: integer()
      end

      defmodule Example do
        use TypeCheck, overrides: [{&amp;Original.t/0, &amp;Replacement.t/0}]

        @spec! times_two(Original.t()) :: integer()
        def times_two(input) do
          input * 2
        end
      end
</code></pre>
<p>Or indeed:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule TypeOverrides do
  use TypeCheck
  import TypeCheck.Builtin
  @opaque! custom_enum() :: impl(Enumerable)
end

defmodule Example do
  use TypeCheck, overrides: [{&amp;Enum.t/0, &amp;TypeOverrides.custom_enum/0}]

  @spec! average(Enum.t()) :: {:ok, float()} | {:error, :empty}
  def average(enumerable) do
    # ... (see first example of post)
  end
end
</code></pre>
<p>As this feature is still very new, there are bound to still be some bugs or edge cases in there.<br>
Also, it would be nice to have support by default already provided for all remote types of Elixir’s standard library.<br>
This is something which will be added in the very near future; probably in the next release.</p>
<hr>
<h2><a name="p-226536-what-is-next-3" class="anchor" href="#p-226536-what-is-next-3" aria-label="Heading link" rel="nofollow"></a>What is next?</h2>
<p>A detailed long-term roadmap is available in the Readme.<br>
In the short-term, focus is on the following:</p>
<ul>
<li>Improve code-coverage of the testing suite</li>
<li>Move the CI from Travis to GitHub’s workflows, and test against newer (and possibly some older) Elixir versions</li>
<li>Add a set of ‘default overrides’ for the common remote types that are part of the Elixir standard library (such as <code>Enum.t()</code>, <code>Range.t()</code>, <code>DateTime.t()</code> etc.).</li>
<li>Be able to limit the depth of the generated checks, to further increase performance for production environments.</li>
</ul> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="226536" data-batch-url="/posts/batch_likers">
                        11
                      </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/64">Post #63</a>
	                </div>
	            </div>
              <div id="likers-container-226536" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="226536"
                     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 #63"></div>
  </section>
</div>
    <div class="postbit" id="226753" data-post-id="226753">
  <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">
								<h1><a name="p-226753-version-050-has-been-released-blush-1" class="anchor" href="#p-226753-version-050-has-been-released-blush-1" aria-label="Heading link" rel="nofollow"></a>Version 0.5.0 has been released! <img src="https://forum.elixirforum.com/images/emoji/apple/blush.png?v=15" title=":blush:" class="emoji" alt=":blush:" loading="lazy" width="20" height="20"></h1>
<p>This version adds a number of stability and ‘quality of life’ improvements.</p>
<h2><a name="p-226753-additions-improvements-2" class="anchor" href="#p-226753-additions-improvements-2" aria-label="Heading link" rel="nofollow"></a>Additions &amp; Improvements</h2>
<ul>
<li>Adding the option <code>debug: true</code>, wich can be passed to <code>use TypeCheck</code> or <code>TypeCheck.conform/3</code> (and variants), which will (at compile-time) print the checks that TypeCheck is generating. <a href="https://gist.github.com/Qqwy/715b31cee2c93e7a658b4b4e51ea4b37" rel="noopener nofollow ugc">Example</a>.</li>
<li>Allow disabling the generation of a typespec, by writing <code>@autogen_typespec false</code>. This will ensure that no typespec is exported for the next <code>@type!</code>/<code>@opaque</code>/<code>@spec!</code> encountered in a module. <a href="https://gist.github.com/Qqwy/8c699d13355512a4946f7fa2a94fb8f5" rel="noopener nofollow ugc">Example</a>.</li>
<li>Actually by default autogenerate a <code>@spec</code> typespec for all <code>@spec!</code>'s.</li>
<li>Code coverage of the test-suite increased to &gt; 85%.</li>
</ul>
<h2><a name="p-226753-fixes-3" class="anchor" href="#p-226753-fixes-3" aria-label="Heading link" rel="nofollow"></a>Fixes</h2>
<ul>
<li>Bugfixes w.r.t. generating typespecs that Elixir/Dialyzer is happy with.</li>
<li>Fixes compiler-warnings on unused named types when using a type guard.</li>
<li>Fixes any warnings that were triggered during the test suite before.</li>
</ul>
<h2><a name="p-226753-meta-4" class="anchor" href="#p-226753-meta-4" aria-label="Heading link" rel="nofollow"></a>Meta</h2>
<ul>
<li>Moving from Travis CI to GitHub Workflows</li>
<li>Setting up Coveralls for code coverage.</li>
</ul> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="226753" data-batch-url="/posts/batch_likers">
                        12
                      </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/65">Post #64</a>
	                </div>
	            </div>
              <div id="likers-container-226753" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="226753"
                     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 #64"></div>
  </section>
</div>
    <div class="postbit" id="226808" data-post-id="226808">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Wow, this is a nice release! Really great to have escape holes with the new <code>@autogen_typespec false</code> option and the <code>use TypeCheck, debug: true</code> debug output is really interesting for everyone wanting to understand the inner workings of TypeCheck. Thank you, I feel now the library is ready to be used for production 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="226808" 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/66">Post #65</a>
	                </div>
	            </div>
              <div id="likers-container-226808" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="226808"
                     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 #65"></div>
  </section>
</div>
    <div class="postbit" id="226951" data-post-id="226951">
  <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">
								<h1><a name="p-226951-version-060-has-been-released-rocket-1" class="anchor" href="#p-226951-version-060-has-been-released-rocket-1" aria-label="Heading link" rel="nofollow"></a>Version 0.6.0 has been released! <img src="https://forum.elixirforum.com/images/emoji/apple/rocket.png?v=15" title=":rocket:" class="emoji" alt=":rocket:" loading="lazy" width="20" height="20"></h1>
<p>Its main changes are the addition of <strong>spectests</strong> and the implementation of a very large portion of the types in all modules of  Elixir’s standard library.</p>
<h2><a name="p-226951-additions-improvements-2" class="anchor" href="#p-226951-additions-improvements-2" aria-label="Heading link" rel="nofollow"></a>Additions &amp; Improvements:</h2>
<ul>
<li>Adding <code>TypeCheck.ExUnit</code>, with the function <code>spectest</code> to test function-specifications.
<ul>
<li>Possibility to use options <code>:except</code>, <code>:only</code>, <code>:initial_seed</code>.</li>
<li>Possibility to pass custom options to StreamData.</li>
</ul>
</li>
<li>Adding <code>TypeCheck.DefaultOverrides</code> with many sub-modules containing checked typespecs for the types in Elixir’s standard library (75% done).
<ul>
<li>Ensure that these types are correct also on older Elixir versions (1.9, 1.10, 1.11)</li>
</ul>
</li>
<li>By default load these ‘DefaultOverrides’, but have the option to turn this behaviour off in <code>TypeCheck.Option</code>.</li>
<li>Nice generators for <code>Enum.t</code>, <code>Collectable.t</code>, <code>String.t</code>.</li>
<li>Support for the builtin types:
<ul>
<li><code>pid()</code></li>
<li><code>nonempty_list()</code>, <code>nonempty_list(type)</code>.</li>
</ul>
</li>
<li>Allow <code>use TypeCheck</code> in IEx or other non-module contexts, to require <code>TypeCheck</code> and import <code>TypeCheck.Builtin</code> in the current scope (without importing/using the macros that only work at the module level.)</li>
<li>The introspection function <code>__type_check__/1</code> is now added to any module that contains a <code>use TypeCheck</code>.</li>
</ul>
<h3><a name="p-226951-fixes-3" class="anchor" href="#p-226951-fixes-3" aria-label="Heading link" rel="nofollow"></a>Fixes</h3>
<ul>
<li>Fixes the <code>Inspect</code> implementation of custom structs, by falling back to <code>Any</code>, which is more useful than attempting to use a customized implementation that would try to read the values in the struct and failing because the struct-type containing types in the fields.</li>
<li>Fixes conditional compilation warnings when optional dependency <code>:stream_data</code> was not included in your project.</li>
</ul>
<h1><a name="p-226951-what-is-a-spectest-4" class="anchor" href="#p-226951-what-is-a-spectest-4" aria-label="Heading link" rel="nofollow"></a>What is a spectest?</h1>
<p>A ‘function-specification test’ is a property-based test in which<br>
we check whether the function adheres to its <em>invariants</em><br>
(also known as the function’s <em>contract</em> or <em>preconditions and postconditions</em>).</p>
<p>We generate a large amount of possible function inputs,<br>
and for each of these, check whether the function:</p>
<ul>
<li>Does not raise an exception.</li>
<li>Returns a result that type-checks against the function-spec’s return-type.</li>
</ul>
<p>While <code>@spec!</code>s themselves ensure that <em>callers</em> do not mis-use your function,<br>
a <code>spectest</code> ensures¹ that the function <em>itself</em> is working correctly.</p>
<p>Spectests are given its own test-category in ExUnit, for easier recognition<br>
(Just like ‘doctests’ and ‘properties’ are different from normal tests, so are ‘spectests’.)</p>
<p>¹: <small>Because of the nature of property-based testing, we can never know for 100% sure<br>
that a function is correct. However, with every new randomly-generated<br>
test-case, the level of confidence grows a little. So while we<br>
can never by <em>fully</em> sure, we are able to get asymptotically close to it.</small></p>
<h3><a name="p-226951-example-5" class="anchor" href="#p-226951-example-5" aria-label="Heading link" rel="nofollow"></a>Example:</h3>
<p>Given the module</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule SpectestExample do
  use TypeCheck

  @spec! average(list(number())) :: number()
  def average(vals)  do
    Enum.sum(vals) / Enum.count(vals)
  end
end

</code></pre>
<p>And the test file</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule SpectestTest do
  use ExUnit.Case
  import TypeCheck.ExUnit

  spectest SpectestExample
end
</code></pre>
<p>We receive the following output when running the tests:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">mix test test/spectest_test.exs 
Compiling 1 file (.ex)


  1) spectest average(list(number())) :: number() (SpectestTest)
     test/spectest_test.exs:5
     Spectest failed (after 0 successful runs)
     
     Input: SpectestExample.average([])
     
     ** (ArithmeticError) bad argument in arithmetic expression
     
     code: #TypeCheck.Spec&lt;  average(list(number())) :: number() &gt;
     stacktrace:
       (type_check 0.5.0) lib/debug_example.ex:6: SpectestExample."average (overridable 1)"/1
       lib/type_check/ex_unit.ex:5: anonymous fn/1 in SpectestTest."spectest average(list(number())) :: number()"/1
       (stream_data 0.5.0) lib/stream_data.ex:2102: StreamData.check_all/7
       lib/type_check/ex_unit.ex:5: (test)



Finished in 0.08 seconds (0.00s async, 0.08s sync)
1 spectest, 1 failure

Randomized with seed 792447

</code></pre>
<p>So in this example, we forgot to handle empty lists correctly.<br>
We might decide to either require the user to pass a <code>nonempty_list()</code> (in which case a <code>TypeError</code> will be raised for empty lists), or instead decide to alter the internals and the return type of the function (like returning <code>{:ok, number} | {:error, :empty}</code>).</p>
<p>in either case, this will then make the spectest pass <img src="https://forum.elixirforum.com/images/emoji/apple/blush.png?v=15" title=":blush:" class="emoji" alt=":blush:" loading="lazy" width="20" height="20"> .</p>
<h1><a name="p-226951-default-overrides-6" class="anchor" href="#p-226951-default-overrides-6" aria-label="Heading link" rel="nofollow"></a>Default Overrides</h1>
<p>The large amount of ‘default overrides’ now means that you can just use <code>Range.t</code>, <code>String.t</code>, <code>Enum.t</code>, <code>MapSet.t</code> etc. in your types and specs to your hearts content.<br>
Not all types of Elixir’s standard library are supported yet, but most of them are.</p>
<hr>
<p>I am very excited and eager to hear what you think of the new features!</p>
<p>~Marten</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="226951" data-batch-url="/posts/batch_likers">
                        11
                      </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/67">Post #66</a>
	                </div>
	            </div>
              <div id="likers-container-226951" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="226951"
                     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 #66"></div>
  </section>
</div>
    <div class="postbit" id="227088" data-post-id="227088">
  <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><a class="mention" href="/u/baldwindavid" rel="nofollow">@baldwindavid</a> pointed out that it had gotten a bit out of date, so I spent some time to rewrite the <a href="https://hexdocs.pm/type_check/comparing-typecheck-and-norm.html" rel="noopener nofollow ugc">Comparing TypeCheck and Norm</a> page.</p>
<p>If you’re curious about how TypeCheck’s approach to data validation and generation compares to <a class="mention" href="/u/keathley" rel="nofollow">@keathley</a>’s <a href="https://hex.pm/packages/norm" rel="nofollow">Norm</a>, do check it out!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="227088" data-batch-url="/posts/batch_likers">
                        7
                      </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/68">Post #67</a>
	                </div>
	            </div>
              <div id="likers-container-227088" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="227088"
                     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 #67"></div>
  </section>
</div>
    <div class="postbit" id="227171" data-post-id="227171">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This is really neat! Typechecking is one of the missing pieces in the Elixir ecosystem, excited to see this added!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="227171" 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/69">Post #68</a>
	                </div>
	            </div>
              <div id="likers-container-227171" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="227171"
                     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 #68"></div>
  </section>
</div>
    <div class="postbit" id="227311" data-post-id="227311">
  <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>That page is an instant bookmark, thanks for writing it!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="227311" 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/70">Post #69</a>
	                </div>
	            </div>
              <div id="likers-container-227311" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="227311"
                     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 #69"></div>
  </section>
</div>
    <div class="postbit" id="227417" data-post-id="227417">
  <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">
								<h1><a name="p-227417-version-070httpshexpmpackagestype_check-has-been-released-partying_face-1" class="anchor" href="#p-227417-version-070httpshexpmpackagestype_check-has-been-released-partying_face-1" aria-label="Heading link" rel="nofollow"></a><a href="https://hex.pm/packages/type_check" rel="nofollow">Version 0.7.0</a> has been released! <img src="https://forum.elixirforum.com/images/emoji/apple/partying_face.png?v=15" title=":partying_face:" class="emoji" alt=":partying_face:" loading="lazy" width="20" height="20"></h1>
<h2><a name="p-227417-additions-improvements-2" class="anchor" href="#p-227417-additions-improvements-2" aria-label="Heading link" rel="nofollow"></a>Additions &amp; Improvements</h2>
<ul>
<li>Addition of the option <code>enable_runtime_checks</code>. When false, all runtime checks in the given module are completely disabled. This is useful to for instance disable checks in a particular environment. (c.f. <a href="https://github.com/Qqwy/elixir-type_check/issues/52" rel="noopener nofollow ugc">#52</a>) Thank you, <a class="mention" href="/u/baldwindavid" rel="nofollow">@baldwindavid</a>!</li>
<li>Adding <code>DateTime.t</code> to the default overrides of Elixir’s standard library, as it was still missing.</li>
</ul>
<hr>
<p>Besides this new version being released, I have spent some time to write an in-depth introductionary article:</p>
<h2><a name="p-227417-type-checking-and-spec-testing-with-typecheckhttpshexdocspmtype_checktype-checking-and-spec-testing-with-typecheckhtml-3" class="anchor" href="#p-227417-type-checking-and-spec-testing-with-typecheckhttpshexdocspmtype_checktype-checking-and-spec-testing-with-typecheckhtml-3" aria-label="Heading link" rel="nofollow"></a><a href="https://hexdocs.pm/type_check/type-checking-and-spec-testing-with-typecheck.html" rel="noopener nofollow ugc"> Type-checking and spec-testing with TypeCheck</a></h2>
<p><em>(<a href="https://forum.elixirforum.com/t/elixir-blog-post-type-checking-and-spec-testing-with-typecheck/42737" rel="nofollow">Forum topic about the article</a>)</em></p>
<p>If you were still unsure whether TypeCheck was for you, or how to use it, I urge you to give it a read! <img src="https://forum.elixirforum.com/images/emoji/apple/blush.png?v=15" title=":blush:" class="emoji" alt=":blush:" 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="227417" data-batch-url="/posts/batch_likers">
                        7
                      </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/71">Post #70</a>
	                </div>
	            </div>
              <div id="likers-container-227417" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="227417"
                     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 #70"></div>
  </section>
</div>
    <div class="postbit" id="227553" data-post-id="227553">
  <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">
								<h1><a name="p-227553-version-080httpshexpmpackagestype_check-has-been-released-ship-1" class="anchor" href="#p-227553-version-080httpshexpmpackagestype_check-has-been-released-ship-1" aria-label="Heading link" rel="nofollow"></a><a href="https://hex.pm/packages/type_check" rel="nofollow">Version 0.8.0</a> has been released! <img src="https://forum.elixirforum.com/images/emoji/apple/ship.png?v=15" title=":ship:" class="emoji" alt=":ship:" loading="lazy" width="20" height="20"></h1>
<h2><a name="p-227553-additions-improvements-2" class="anchor" href="#p-227553-additions-improvements-2" aria-label="Heading link" rel="nofollow"></a>Additions &amp; Improvements</h2>
<ul>
<li>Pretty-printing of types and TypeError output in multiple colors:</li>
</ul>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/a/0/a0822e4ac708dd24cee345da047e06d40eba8d42.png" data-download-href="https://forum.elixirforum.com/uploads/default/a0822e4ac708dd24cee345da047e06d40eba8d42" title="image" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/optimized/3X/a/0/a0822e4ac708dd24cee345da047e06d40eba8d42_2_690x224.png" alt="image" data-base62-sha1="mTViZQeclxQq9CW2TqoMHR9OBiO" width="690" height="224" srcset="https://forum.elixirforum.com/uploads/default/optimized/3X/a/0/a0822e4ac708dd24cee345da047e06d40eba8d42_2_690x224.png, https://forum.elixirforum.com/uploads/default/optimized/3X/a/0/a0822e4ac708dd24cee345da047e06d40eba8d42_2_1035x336.png 1.5x, https://forum.elixirforum.com/uploads/default/original/3X/a/0/a0822e4ac708dd24cee345da047e06d40eba8d42.png 2x" data-dominant-color="17151E"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1140×371 63.8 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>(This is the ‘Rating’ example from the <a href="https://hexdocs.pm/type_check/type-checking-and-spec-testing-with-typecheck.html" rel="noopener nofollow ugc">Type-checking and spec-testing with TypeCheck</a> article).<br>
Types and values are pretty-printed in colour, similarly to how this is normally done in IEx.</p>
<ul>
<li>Nicer indentation of errors. Amongst other things, this means that error-highlighting in the documentation now works correctly (although in 100% ‘red’).</li>
<li><code>use TypeCheck</code> now also calls <code>require TypeCheck.Type</code> so there no longer is a need to call this manually if you want to e.g. use <code>TypeCheck.Type.build/1</code> (which is rather common if you want to test out particular types quickly in IEx).</li>
<li>named types are now printed in abbreviated fashion if they are repeated multiple times in an error message. This makes a nested error message <em>much</em> easier to read, especially for larger specs.</li>
<li>Remote/user-defined types are now also ‘named types’ which profit from this change.<br>
For instance in above example picture, we first talk about <code>Rating.t()</code> and <code>String.t()</code> and only when looking at the problem in detail do we expand this to <code>%Rating{}</code> and <code>binary()</code>.</li>
<li><code>[type]</code> no longer creates a <code>fixed_list(type)</code> but instead a <code>list(type)</code> (just as Elixir’s own typespecs.)</li>
<li>Support for <code>[...]</code> and <code>[type, ...]</code>as alias for <code>nonempty_list()</code> and <code>nonempty_list(type)</code> respectively.</li>
</ul>
<h2><a name="p-227553-fixes-3" class="anchor" href="#p-227553-fixes-3" aria-label="Heading link" rel="nofollow"></a>Fixes</h2>
<ul>
<li>Fixes prettyprinting of <code>TypeCheck.Builtin.Range</code>.</li>
<li>Remove support for list literals with multiple elements.</li>
<li>Improved documentation.</li>
</ul> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="227553" data-batch-url="/posts/batch_likers">
                        6
                      </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/72">Post #71</a>
	                </div>
	            </div>
              <div id="likers-container-227553" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="227553"
                     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 #71"></div>
  </section>
</div>
    <div class="postbit" id="227554" data-post-id="227554">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sb8244" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sb8244/120/18642_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sb8244
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Real-Time Phoenix</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Are there any plans on how to do this without requiring a use in every module? I had been thinking through this problem and got stuck. Tracer and use are the best options I could consider.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="227554" 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/73">Post #72</a>
	                </div>
	            </div>
              <div id="likers-container-227554" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="227554"
                     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 #72"></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=8">Load more posts (30 remaining)</a>
</div></template></turbo-stream>