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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="IvanR" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/IvanR/120/25095_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  IvanR
                    <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>Thanks for pointing out the confusion with the example.</p>
<p>Domo brings several possible benefits. And more explicit version of the example can be like this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">mix new try_domo &amp;&amp; cd try_domo &amp;&amp; asdf local elixir master

sed -i '' 's/# {:dep_from_hexpm, "~&gt; 0.3.0"}/{:domo, "&gt;= 0.0.0"}/g' ./mix.exs

echo """
defmodule Order do
  use Domo

  deftag Id, for_type: String.t()

  typedstruct do
    field :id, Id.t()
    field :note, :none | String.t(), default: :none
    field :quantity, integer
  end
end
""" &gt; lib/order.ex

echo """
defmodule User do
  use Domo

  deftag Id, for_type: String.t()

  typedstruct do
    field :id, Id.t()
    field :name, String.t()
  end
end
""" &gt; lib/user.ex

mix deps.get &amp;&amp; iex -S mix

iex(1)&gt; import Domo
iex(2)&gt; alias Order.Id
iex(3)&gt; Order.new!(
...(3)&gt;   id: Id --- "156",
...(3)&gt;   quantity: 150
...(3)&gt; )
%Order{
  id: {Order.Id, "156"},
  note: :none,
  quantity: 150
}
iex(4)&gt; Order.new!(
...(4)&gt;   id: Id --- "157",
...(4)&gt;   note: "Clear out the delivery date",
...(4)&gt;   quantity: 220
...(4)&gt; )
%Order{
  id: {Order.Id, "157"},
  note: "Clear out the delivery date",
  quantity: 220
}
iex(5)&gt; Order.new!(
...(5)&gt;   id: User.Id --- "157",
...(5)&gt;   quantity: 540
...(5)&gt; )
** (ArgumentError) Can't construct %Order{...} with new!([id: {User.Id, "157"}, quantity: 540])
    Unexpected value type for the field :id. The value {User.Id, "157"} doesn't match the Id.t() type.
    (try_domo 0.1.0) lib/domo/struct_functions_generator.ex:20: Order.new!/1
    (stdlib 3.11.1) erl_eval.erl:680: :erl_eval.do_apply/6
    (iex 1.11.0-dev) lib/iex/evaluator.ex:258: IEx.Evaluator.handle_eval/5
iex(6)&gt; Order.new!(
...(6)&gt;   id: "156",
...(6)&gt;   note: nil,
...(6)&gt;   quantity: "One hundred fifty"
...(6)&gt; )
** (ArgumentError) Can't construct %Order{...} with new!([id: "156", note: nil, quantity: "One hundred fifty"])
    Unexpected value type for the field :id. The value "156" doesn't match the Id.t() type.
    Unexpected value type for the field :note. The value nil doesn't match the :none | String.t() type.
    Unexpected value type for the field :quantity. The value "One hundred fifty" doesn't match the integer type.
    (try_domo 0.1.0) lib/domo/struct_functions_generator.ex:20: Order.new!/1
    (stdlib 3.11.1) erl_eval.erl:680: :erl_eval.do_apply/6
    (iex 1.11.0-dev) lib/iex/evaluator.ex:258: IEx.Evaluator.handle_eval/5
</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="179383" 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/user-defined-tags-and-type-safe-structs-for-domain-modelling-domo-library/32242/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-179383" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="179383"
                     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>