<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="7440" data-post-id="7440">
  <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/nobbz" rel="nofollow">@NobbZ</a> You are right. Naming Algebraic Data Types ‘containers’ does not cover all of them, but it seemed like a simple word to use for people who had never heard of them before.</p>
<p>A possibly better alternative, that is still understandable for outsiders, might be <em>Composite Types</em>.</p>
<p>I like your introduction, and it actually hadn’t occured to me before that enumerated types are a kind of ADT as well.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="7440" 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/funland-algebraic-container-data-types-for-elixir-prerelease/1169/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-7440" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="7440"
                     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="7443" data-post-id="7443">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p>Compared to a Union type:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">type MyWellTypedMaybe
  = ImAString String
  | ImAnInt Int
</code></pre>
</blockquote>
<p>This is a specialised version of <code>Either a b</code>, namely <code>Either String Int</code>. In a language like elm, which does not know about classes or interfaces, it makes absolutely sense to use specialised versions.</p>
<p>But for Haskell or Idris or even Elixir + <code>fun_land</code> where you can define some kind of interface around some type like <code>Foldable</code>, <code>Monad</code> and whatnot, it’s much easier for a programmer to have that generic <code>Either a b</code> and reuse its instances.</p>
<p>Personally, I really like some of the pre 0.17 concepts of elm, but the absence of classes/interfaces was a showstopper for me. And now with 0.17 where they are moving away from FRP, I am not sure how this will continue and I will continue my search for some good JS replacement…</p>
<p>Also the thing you are calling union-type here is called sum-type in Haskell, since it can represent as many values as <code>Int</code> + <code>String</code> could. On the opposite we have product-types (<code>type Person = Person String Int</code>) which can represent as many values as <code>String</code> * <code>Int</code> could.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="7443" 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/funland-algebraic-container-data-types-for-elixir-prerelease/1169/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-7443" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="7443"
                     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="7444" data-post-id="7444">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>In Elm you could implement Either like:</p>
<pre data-code-wrap="elm"><code class="lang-elm">type Either left right
  = Left left
  | Right right
</code></pre>
<p>Then you could just do <code>Either String Int</code> or whatever.  I am actually really big on the lack of classes/interfaces myself, those are often just a poorly made crutch for lack of proper function passing/currying/closures, which Elm has fine.</p>
<p>(EDIT:  And I really really like exceptionally really hate a generic <code>Either</code>, I’ve never seen a case where a properly named enum/union type is not better.  In the example supplied of Foldable and Monad a Result would be more descriptive as Ok/Error make sense, Left/Right does not.  Naming is important.)</p>
<aside class="quote no-group" data-username="NobbZ" data-post="13" data-topic="1169">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/nobbz/48/27235_2.png" class="avatar"> NobbZ:</div>
<blockquote>
<p>Also the thing you are calling union-type here is called sum-type in Haskell, since it can represent as many values as Int + String could. On the opposite we have product-types (type Person = Person String Int) which can represent as many values as String * Int could.</p>
</blockquote>
</aside>
<p>Eh not entirely, a union in Elm could also be something like this:</p>
<pre data-code-wrap="elm"><code class="lang-elm">type Msg
    = Mdl Material.Msg
    | InfoConnect Int
    | RoomList_Init Int RoomDefs
    | SelectRoom Int
    | Room_Connect Int
    | Room_Info Int {}
    | RoomMsg_Init Int RoomMessages
    | RoomMsg_Add Int RoomMessages
    | RoomMsg_SyncState Int RoomSyncState
    | RoomMsg_SyncJoin Int RoomSyncEvent
    | RoomMsg_SyncLeave Int RoomSyncEvent
    | ClickUser String
    | MsgInput_Change String
    | MsgInput_Send
    | MsgInput_ToggleMultiline
</code></pre>
<p>It is not a sum type, it is a tagged union (in Erlang/Elixir parlance it is a 2-tuple of <code>{:tagname, data}</code>).  You can have empty data tags like <code>MsgInput_Send</code> and <code>MsgInput_ToggleMultiline</code> above.  You can have types with duplicate data types like <code>ClickUser String</code> and <code>MsgInput_Change String</code>.  The identifier after the | is a type name, you can even make things that take that given type instead of the whole union, the things after it up to the next | are the data, if any, that the type holds.</p>
<p>But yeah, classes/interfaces missing are a <em>good</em> thing.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="7444" 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/funland-algebraic-container-data-types-for-elixir-prerelease/1169/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-7444" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="7444"
                     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="7452" data-post-id="7452">
  <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>I dont understand of how the genetic Either example you gave for Elm is different from a type constructor in e.g. Haskell. Could you elaborate more?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="7452" 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/funland-algebraic-container-data-types-for-elixir-prerelease/1169/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-7452" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="7452"
                     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="7453" data-post-id="7453">
  <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>I completely agree that a bad generalisation is worse than no generalisation, but on the other hand, good generalisation can prevent you a lot of work. The only ‘problem’ I see, is that the more abstract you try to go, the harder it gets to name things well.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="7453" 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/funland-algebraic-container-data-types-for-elixir-prerelease/1169/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-7453" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="7453"
                     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="7454" data-post-id="7454">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It’s not, that’s the point.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<p>Elm types can take arguments so you can build up more complex types where-ever you need.  I’ve even found cases where it is useful to extend types, which in Elm you can do like:</p>
<pre data-code-wrap="elm"><code class="lang-elm">-- Convoluted example just to show off syntax
type alias Pos2 baseType valType
  = { baseType
    | x : valType
    , y : valType
    }

type alias Pos3 valType
  = Pos2 { z : valType } valType

type alias Pos3Float
  = Pos3 Float

-- All of these are equal because I used alias above, alias means unnamed type, purely structural
Pos2 {z : Float} Float
Pos3 Float
Pos3Float

-- This structure would satisfy them all
{ x: 3.14
, y: 4.25
, z: 5.36
}
</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="7454" 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/funland-algebraic-container-data-types-for-elixir-prerelease/1169/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-7454" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="7454"
                     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 #16"></div>
  </section>
</div>
    <div class="postbit" id="7455" data-post-id="7455">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="14" data-topic="1169">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Eh not entirely, a union in Elm could also be something like this:</p>
</blockquote>
</aside>
<p>Which is perfectly fine a sum-type.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">type Msg
    = Mdl Material.Msg  -- as many values as Material.Msg has
    | InfoConnect Int -- as many values as Int has
    | RoomList_Init Int RoomDefs -- as many values as Int * RoomDefs has
    | SelectRoom Int -- as many values as Int has
    | Room_Connect Int -- as many values as Int has
    | Room_Info Int {} -- as many values as Int * {} has (and {} is HUGE!)
    | RoomMsg_Init Int RoomMessages -- as many values as Int * RoomMessages has
    | RoomMsg_Add Int RoomMessages -- as many values as Int * RoomMessages has
    | RoomMsg_SyncState Int RoomSyncState -- as many values as Int * RoomSyncSte has
    | RoomMsg_SyncJoin Int RoomSyncEvent -- as many values as Int * RoomSyncEvent has
    | RoomMsg_SyncLeave Int RoomSyncEvent -- as many values as Int * RoomSyncEvent has
    | ClickUser String -- as many values as String has
    | MsgInput_Change String -- as many values as String has
    | MsgInput_Send -- exactly 1 value
    | MsgInput_ToggleMultiline  -- exactly 1 value
</code></pre>
<p>The type <code>Msg</code> itself has as many values as the sum of all tags have.</p>
<p>If something is not a sumtype, it has to be a product type.</p>
<p>NB: Because we can “sum” and “multiply” the cardinality of types (sets) we named it <strong>algebraic</strong> data types <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" 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="7455" 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/funland-algebraic-container-data-types-for-elixir-prerelease/1169/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-7455" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="7455"
                     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 #17"></div>
  </section>
</div>
    <div class="postbit" id="7456" data-post-id="7456">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Well in Elm the {} is the empty record, it will store nothing.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="7456" 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/funland-algebraic-container-data-types-for-elixir-prerelease/1169/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-7456" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="7456"
                     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 #18"></div>
  </section>
</div>
    <div class="postbit" id="7457" data-post-id="7457">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>This example is merely syntax, and I am not really sure if I like it beeing able to inject additional fields into a type like that… I could go back to ruby and monkey patch there…</p>
<p>And <code>{}</code> is similar to haskells <code>()</code> then? OK, I thought it was like “any record”, similar to <code>map/0</code>-type in Elixir.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="7457" 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/funland-algebraic-container-data-types-for-elixir-prerelease/1169/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-7457" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="7457"
                     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 #19"></div>
  </section>
</div>
    <div class="postbit" id="7481" data-post-id="7481">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="NobbZ" data-post="20" data-topic="1169">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/nobbz/48/27235_2.png" class="avatar"> NobbZ:</div>
<blockquote>
<p>And {} is similar to haskells () then? OK, I thought it was like “any record”, similar to map/0-type in Elixir.</p>
</blockquote>
</aside>
<p>Yeah I am just using them as a placeholder until I get later code complete that will use them.  I can update them later with the actual type they will need to be and get compilation failures everywhere that currently use it, so it works well for my style.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="NobbZ" data-post="20" data-topic="1169">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/nobbz/48/27235_2.png" class="avatar"> NobbZ:</div>
<blockquote>
<p>This example is merely syntax, and I am not really sure if I like it beeing able to inject additional fields into a type like that… I could go back to ruby and monkey patch there…</p>
</blockquote>
</aside>
<p>Edit:  Oh, and you are not injecting types there, rather that only works with Records (not unions or anything else), and it makes a ‘new’ record type of your extended type.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="7481" 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/funland-algebraic-container-data-types-for-elixir-prerelease/1169/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-7481" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="7481"
                     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 #20"></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/1169/load_more?page=3">Load more posts (15 remaining)</a>
</div></template></turbo-stream>