some fixes
This commit is contained in:
parent
dceac9e1e4
commit
6e08bf59be
14 changed files with 32 additions and 83 deletions
|
@ -630,7 +630,7 @@ Haskell types is fractal:</p>
|
|||
</section>
|
||||
<section class="slide">
|
||||
<h2 id="also-functor-inside-hask">Also Functor inside \(\Hask\)</h2>
|
||||
<p><code>length</code> can be seen as a Functor from the category <code>[a]</code> to <code>Int</code>. More precisely:</p>
|
||||
<p><code>length</code> can be seen as a Functor from the category <code>[a]</code> to the cateogry <code>Int</code>:</p>
|
||||
<ul class="left">
|
||||
<li>\(\ob{\mathtt{[a]}}=\{∙\}\)</li>
|
||||
<li>\(\hom{\mathtt{[a]}}=\mathtt{[a]}\)</li>
|
||||
|
@ -656,14 +656,13 @@ Haskell types is fractal:</p>
|
|||
<li>\(\hom{\E_\C}\): natural transformations
|
||||
<ul>
|
||||
<li>η familly \(η_X\in\hom{\C}\) for \(X\in\ob{\C}\) s.t.</li>
|
||||
<li>for Haskell functors: <code>F a -> G a</code> are the natural transformations.<br />List to Trees, Tree to List, Tree to Maybe...<br />Rearragement functions only.</li>
|
||||
<li>for Haskell functors: <code>F a -> G a</code>.<br />Rearragement functions only.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="slide">
|
||||
<h2 id="natural-transformation-examples">Natural Transformation Examples</h2>
|
||||
<h2 id="natural-transformation-examples-13">Natural Transformation Examples (1/3)</h2>
|
||||
<pre><code class="haskell">data Tree a = Empty | Node a [Tree a]
|
||||
deriving (Show)
|
||||
toTree :: [a] -> Tree a
|
||||
toTree [] = Empty
|
||||
toTree (x:xs) = Node x [toTree xs]</pre>
|
||||
|
@ -677,9 +676,8 @@ toTree (x:xs) = Node x [toTree xs]</pre>
|
|||
|
||||
</section>
|
||||
<section class="slide">
|
||||
<h2 id="natural-transformation-examples">Natural Transformation Examples</h2>
|
||||
<h2 id="natural-transformation-examples-23">Natural Transformation Examples (2/3)</h2>
|
||||
<pre><code class="haskell">data Tree a = Empty | Node a [Tree a]
|
||||
deriving (Show)
|
||||
toList :: Tree a -> [a]
|
||||
toList Empty = []
|
||||
toList (Node x l) = [x] ++ concat (map toList l)</pre>
|
||||
|
@ -687,13 +685,13 @@ toList (Node x l) = [x] ++ concat (map toList l)</pre>
|
|||
<p><code>toList</code> is a natural transformation. It is also a morphism from <code>Tree</code> to <code>[]</code> in the Category of \(\) endofunctors.</p>
|
||||
<img style="float:left;width:50%" src="categories/img/mp/nattrans-tree-list.png" alt="natural transformation commutative diagram"/>
|
||||
<figure style="float:right;width:40%">
|
||||
<img src="categories/img/mp/tree-list-endofunctor-morphism.png" alt="natural transformation commutative diagram"/> <figcaption><code>toList.toTree=id</code> <span class="and">&</span> <code>toTree.toList=id</code>.<br/> Therefore <code>[]</code> <span class="and">&</span> <code>Tree</code> are <span class="yellow">isomorph</span>. </figcaption>
|
||||
<img src="categories/img/mp/tree-list-endofunctor-morphism.png" alt="natural transformation commutative diagram"/> <figcaption><code>toList . toTree = id</code> <span class="and">&</span><br/> <code>toTree . toList = id</code> <span style="visibility:hidden"><span class="and">&</span></span><br/> therefore <code>[]</code> <span class="and">&</span> <code>Tree</code> are <span class="yellow">isomorph</span>. </figcaption>
|
||||
</figure>
|
||||
|
||||
|
||||
</section>
|
||||
<section class="slide">
|
||||
<h2 id="another-nat.-trans.-example">Another Nat. Trans. Example</h2>
|
||||
<h2 id="natural-transformation-examples-33">Natural Transformation Examples (3/3)</h2>
|
||||
<pre><code class="haskell">
|
||||
toMaybe :: [a] -> Maybe a ; mToList :: Maybe a -> [a]
|
||||
toMaybe [] = Nothing ; mToList Nothing = []
|
||||
|
@ -707,21 +705,6 @@ toMaybe (x:xs) = Just x ; mToList Just x = [x]
|
|||
</figure>
|
||||
|
||||
|
||||
</section>
|
||||
<section class="slide">
|
||||
<h2 id="another-nat.-trans.-example">Another Nat. Trans. Example</h2>
|
||||
<pre><code class="haskell">
|
||||
toMaybe :: [a] -> Maybe a
|
||||
toMaybe [] = Nothing
|
||||
toMaybe (x:xs) = Just x</pre>
|
||||
</code>
|
||||
<p><code>toMaybe</code> is a natural transformation. It is also a morphism from <code>[]</code> to <code>Maybe</code> in the Category of \(\) endofunctors.</p>
|
||||
<img style="float:left;width:50%" src="categories/img/mp/nattrans-maybe-list.png" alt="natural transformation commutative diagram"/>
|
||||
<figure style="float:right;width:40%">
|
||||
<img src="categories/img/mp/maybe-list-endofunctor-morphism.png" alt="natural transformation commutative diagram"/> <figcaption>There is no isomorphism.<br/> Hint: List with more than one element. </figcaption>
|
||||
</figure>
|
||||
|
||||
|
||||
</section>
|
||||
<section class="slide">
|
||||
<h2 id="monads">Monads</h2>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<h2 id="also-functor-inside-hask">Also Functor inside \(\Hask\)</h2>
|
||||
<p><code>length</code> can be seen as a Functor from the category <code>[a]</code> to <code>Int</code>. More precisely:</p>
|
||||
<p><code>length</code> can be seen as a Functor from the category <code>[a]</code> to the cateogry <code>Int</code>:</p>
|
||||
<ul class="left">
|
||||
<li>\(\ob{\mathtt{[a]}}=\{∙\}\)</li>
|
||||
<li>\(\hom{\mathtt{[a]}}=\mathtt{[a]}\)</li>
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
<li>\(\hom{\E_\C}\): natural transformations
|
||||
<ul>
|
||||
<li>η familly \(η_X\in\hom{\C}\) for \(X\in\ob{\C}\) s.t.</li>
|
||||
<li>for Haskell functors: <code>F a -> G a</code> are the natural transformations.<br />List to Trees, Tree to List, Tree to Maybe...<br />Rearragement functions only.</li>
|
||||
<li>for Haskell functors: <code>F a -> G a</code>.<br />Rearragement functions only.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
|
|
@ -11,6 +11,5 @@ of endofunctors of \\(\\C\\).
|
|||
- \\(\\ob{\\E\_\\C}\\): endofunctors of \\(\\C\\) ; \\(F:\\C→\\C\\)
|
||||
- \\(\\hom{\\E\_\\C}\\): natural transformations
|
||||
- η familly \\(η\_X\\in\\hom{\\C}\\) for \\(X\\in\\ob{\\C}\\) s.t.
|
||||
- for Haskell functors: `F a -> G a` are the natural transformations.
|
||||
List to Trees, Tree to List, Tree to Maybe...
|
||||
- for Haskell functors: `F a -> G a`.
|
||||
Rearragement functions only.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<h2 id="natural-transformation-examples">Natural Transformation Examples</h2>
|
||||
<h2 id="natural-transformation-examples-13">Natural Transformation Examples (1/3)</h2>
|
||||
<pre><code class="haskell">data Tree a = Empty | Node a [Tree a]
|
||||
deriving (Show)
|
||||
toTree :: [a] -> Tree a
|
||||
toTree [] = Empty
|
||||
toTree (x:xs) = Node x [toTree xs]</pre>
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
Natural Transformation Examples
|
||||
-------------------------------
|
||||
Natural Transformation Examples (1/3)
|
||||
------------------------------------
|
||||
|
||||
<pre><code class="haskell">data Tree a = Empty | Node a [Tree a]
|
||||
deriving (Show)
|
||||
toTree :: [a] -> Tree a
|
||||
toTree [] = Empty
|
||||
toTree (x:xs) = Node x [toTree xs]</pre></code>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<h2 id="natural-transformation-examples">Natural Transformation Examples</h2>
|
||||
<h2 id="natural-transformation-examples-23">Natural Transformation Examples (2/3)</h2>
|
||||
<pre><code class="haskell">data Tree a = Empty | Node a [Tree a]
|
||||
deriving (Show)
|
||||
toList :: Tree a -> [a]
|
||||
toList Empty = []
|
||||
toList (Node x l) = [x] ++ concat (map toList l)</pre>
|
||||
|
@ -8,7 +7,7 @@ toList (Node x l) = [x] ++ concat (map toList l)</pre>
|
|||
<p><code>toList</code> is a natural transformation. It is also a morphism from <code>Tree</code> to <code>[]</code> in the Category of \(\) endofunctors.</p>
|
||||
<img style="float:left;width:50%" src="categories/img/mp/nattrans-tree-list.png" alt="natural transformation commutative diagram"/>
|
||||
<figure style="float:right;width:40%">
|
||||
<img src="categories/img/mp/tree-list-endofunctor-morphism.png" alt="natural transformation commutative diagram"/> <figcaption><code>toList.toTree=id</code> & <code>toTree.toList=id</code>.<br/> Therefore <code>[]</code> & <code>Tree</code> are <span class="yellow">isomorph</span>. </figcaption>
|
||||
<img src="categories/img/mp/tree-list-endofunctor-morphism.png" alt="natural transformation commutative diagram"/> <figcaption><code>toList . toTree = id</code> &<br/> <code>toTree . toList = id</code> <span style="visibility:hidden">&</span><br/> therefore <code>[]</code> & <code>Tree</code> are <span class="yellow">isomorph</span>. </figcaption>
|
||||
</figure>
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
Natural Transformation Examples
|
||||
-------------------------------
|
||||
Natural Transformation Examples (2/3)
|
||||
------------------------------------
|
||||
|
||||
<pre><code class="haskell">data Tree a = Empty | Node a [Tree a]
|
||||
deriving (Show)
|
||||
toList :: Tree a -> [a]
|
||||
toList Empty = []
|
||||
toList (Node x l) = [x] ++ concat (map toList l)</pre></code>
|
||||
|
@ -14,7 +13,7 @@ It is also a morphism from `Tree` to `[]` in the Category of \\(\Hask\\) endofun
|
|||
<img style="float:left;width:50%" src="categories/img/mp/nattrans-tree-list.png" alt="natural transformation commutative diagram"/>
|
||||
<figure style="float:right;width:40%">
|
||||
<img src="categories/img/mp/tree-list-endofunctor-morphism.png" alt="natural transformation commutative diagram"/>
|
||||
<figcaption><code>toList.toTree=id</code> & <code>toTree.toList=id</code>.<br/>
|
||||
Therefore <code>[]</code> & <code>Tree</code> are <span class="yellow">isomorph</span>.
|
||||
<figcaption><code>toList . toTree = id</code> &<br/> <code>toTree . toList = id</code> <span style="visibility:hidden">&</span><br/>
|
||||
therefore <code>[]</code> & <code>Tree</code> are <span class="yellow">isomorph</span>.
|
||||
</figcaption>
|
||||
</figure>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<h2 id="another-nat.-trans.-example">Another Nat. Trans. Example</h2>
|
||||
<h2 id="natural-transformation-examples-33">Natural Transformation Examples (3/3)</h2>
|
||||
<pre><code class="haskell">
|
||||
toMaybe :: [a] -> Maybe a ; mToList :: Maybe a -> [a]
|
||||
toMaybe [] = Nothing ; mToList Nothing = []
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Another Nat. Trans. Example
|
||||
---------------------------
|
||||
Natural Transformation Examples (3/3)
|
||||
-------------------------------------
|
||||
|
||||
<pre><code class="haskell">
|
||||
toMaybe :: [a] -> Maybe a ; mToList :: Maybe a -> [a]
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<h2 id="another-nat.-trans.-example">Another Nat. Trans. Example</h2>
|
||||
<pre><code class="haskell">
|
||||
toMaybe :: [a] -> Maybe a
|
||||
toMaybe [] = Nothing
|
||||
toMaybe (x:xs) = Just x</pre>
|
||||
</code>
|
||||
<p><code>toMaybe</code> is a natural transformation. It is also a morphism from <code>[]</code> to <code>Maybe</code> in the Category of \(\) endofunctors.</p>
|
||||
<img style="float:left;width:50%" src="categories/img/mp/nattrans-maybe-list.png" alt="natural transformation commutative diagram"/>
|
||||
<figure style="float:right;width:40%">
|
||||
<img src="categories/img/mp/maybe-list-endofunctor-morphism.png" alt="natural transformation commutative diagram"/> <figcaption>There is no isomorphism.<br/> Hint: List with more than one element. </figcaption>
|
||||
</figure>
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
Another Nat. Trans. Example
|
||||
---------------------------
|
||||
|
||||
<pre><code class="haskell">
|
||||
toMaybe :: [a] -> Maybe a
|
||||
toMaybe [] = Nothing
|
||||
toMaybe (x:xs) = Just x</pre></code>
|
||||
|
||||
|
||||
`toMaybe` is a natural transformation.
|
||||
It is also a morphism from `[]` to `Maybe` in the Category of \\(\Hask\\) endofunctors.
|
||||
|
||||
<img style="float:left;width:50%" src="categories/img/mp/nattrans-maybe-list.png" alt="natural transformation commutative diagram"/>
|
||||
<figure style="float:right;width:40%">
|
||||
<img src="categories/img/mp/maybe-list-endofunctor-morphism.png" alt="natural transformation commutative diagram"/>
|
||||
<figcaption>There is no isomorphism.<br/>
|
||||
Hint: List with more than one element.
|
||||
</figcaption>
|
||||
</figure>
|
|
@ -838,14 +838,16 @@ body.deck-container {
|
|||
background-color: #073642; }
|
||||
.deck-container table tr:nth-child(even) {
|
||||
background-color: #002b36; }
|
||||
.deck-container p pre code, .deck-container ul li pre code, .deck-container ol li pre code {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0; }
|
||||
.deck-container p code, .deck-container ul li code, .deck-container ol li code {
|
||||
background: #053440;
|
||||
border: solid 1px #586e75;
|
||||
padding: 2px; }
|
||||
.deck-container p, .deck-container ul li, .deck-container ol li {
|
||||
line-height: 1.5em; }
|
||||
.deck-container p pre code, .deck-container ul li pre code, .deck-container ol li pre code {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0; }
|
||||
.deck-container p code, .deck-container ul li code, .deck-container ol li code {
|
||||
background: #053440;
|
||||
border: solid 1px #586e75;
|
||||
padding: 2px; }
|
||||
.deck-container ul.sameline {
|
||||
list-style: none; }
|
||||
.deck-container ul.sameline li {
|
||||
|
|
|
@ -1075,6 +1075,7 @@ body.deck-container
|
|||
background-color: $mainBackgroundColor
|
||||
|
||||
p, ul li, ol li
|
||||
line-height: 1.5em
|
||||
pre code
|
||||
background: none
|
||||
border: none
|
||||
|
|
Loading…
Reference in a new issue