<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://coderwiki.org/index.php?action=history&amp;feed=atom&amp;title=Sum_type</id>
	<title>Sum type - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://coderwiki.org/index.php?action=history&amp;feed=atom&amp;title=Sum_type"/>
	<link rel="alternate" type="text/html" href="http://coderwiki.org/index.php?title=Sum_type&amp;action=history"/>
	<updated>2026-05-19T03:45:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://coderwiki.org/index.php?title=Sum_type&amp;diff=106&amp;oldid=prev</id>
		<title>Dylan: add: other algebraic data types</title>
		<link rel="alternate" type="text/html" href="http://coderwiki.org/index.php?title=Sum_type&amp;diff=106&amp;oldid=prev"/>
		<updated>2025-08-15T08:56:15Z</updated>

		<summary type="html">&lt;p&gt;add: other algebraic data types&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 08:56, 15 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l17&quot;&gt;Line 17:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Enum]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Enum]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Tagged union]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Tagged union]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Other algebraic data types ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;See: [[Algebraic data type]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Dylan</name></author>
	</entry>
	<entry>
		<id>http://coderwiki.org/index.php?title=Sum_type&amp;diff=105&amp;oldid=prev</id>
		<title>Dylan: new: info, example, types</title>
		<link rel="alternate" type="text/html" href="http://coderwiki.org/index.php?title=Sum_type&amp;diff=105&amp;oldid=prev"/>
		<updated>2025-08-15T08:55:47Z</updated>

		<summary type="html">&lt;p&gt;new: info, example, types&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;A &amp;#039;&amp;#039;&amp;#039;sum type&amp;#039;&amp;#039;&amp;#039; is a type of [[algebraic data type]]. It is a user-defined [[data type]] that stores a &amp;#039;&amp;#039;&amp;#039;fixed set&amp;#039;&amp;#039;&amp;#039; of possible values. In other words, it is a choice of possibilities as to the data it contains.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Suppose we are in a &amp;#039;&amp;#039;&amp;#039;zoo&amp;#039;&amp;#039;&amp;#039; and want to keep track of animals in the zoo.&lt;br /&gt;
&lt;br /&gt;
An example of a sum type could be an &amp;lt;code&amp;gt;Animal&amp;lt;/code&amp;gt; [[data type]]. [[Variable|Variables]] of this data type can only contain one of these 4 [[Value|values]]:&lt;br /&gt;
&lt;br /&gt;
* Parrot&lt;br /&gt;
* Monkey&lt;br /&gt;
* Tiger&lt;br /&gt;
* Giraffe&lt;br /&gt;
&lt;br /&gt;
This has the benefit of making [[invalid state]] impossible: we are guaranteed that the value of an &amp;lt;code&amp;gt;Animal&amp;lt;/code&amp;gt; [[variable]] will always be one of the 4 above.&lt;br /&gt;
&lt;br /&gt;
== Types of sum-types ==&lt;br /&gt;
&lt;br /&gt;
* [[Enum]]&lt;br /&gt;
* [[Tagged union]]&lt;/div&gt;</summary>
		<author><name>Dylan</name></author>
	</entry>
</feed>