{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}
-
+
diff --git a/_posts/2017-09-27-typoclassopedia-exercise-answers.md b/_posts/2017-09-27-typoclassopedia-exercise-answers.md
index 5d645bf..3b81086 100644
--- a/_posts/2017-09-27-typoclassopedia-exercise-answers.md
+++ b/_posts/2017-09-27-typoclassopedia-exercise-answers.md
@@ -275,3 +275,55 @@ The Functor section links to [Category Theory](https://en.wikibooks.org/wiki/Has
fmap (f . g) (Just x) = Just ((f . g) x) = Just (f (g x))
fmap f (fmap g (Just x)) = Just (f (g x)) = Just ((f . g) x)
```
+
+Applicative
+===========
+
+## Laws
+
+1. The identity law:
+
+ ```haskell
+ pure id <*> v = v
+ ```
+
+2. Homomorphism:
+
+ ```haskell
+ pure f <*> pure x = pure (f x)
+ ```
+
+ Intuitively, applying a non-effectful function to a non-effectful argument in an effectful context is the same as just applying the function to the argument and then injecting the result into the context with pure.
+
+3. Interchange:
+
+ ```haskell
+ u <*> pure y = pure ($ y) <*> u
+ ```
+
+ Intuitively, this says that when evaluating the application of an effectful function to a pure argument, the order in which we evaluate the function and its argument doesn't matter.
+
+4. Composition:
+
+ ```haskell
+ u <*> (v <*> w) = pure (.) <*> u <*> v <*> w
+ ```
+
+ This one is the trickiest law to gain intuition for. In some sense it is expressing a sort of associativity property of (`<*>`). The reader may wish to simply convince themselves that this law is type-correct.
+
+### Exercises
+
+(Tricky) One might imagine a variant of the interchange law that says something about applying a pure function to an effectful argument. Using the above laws, prove that
+
+```haskell
+pure f <*> x = pure (flip ($)) <*> x <*> pure f
+```
+
+**Solution**:
+
+```haskell
+pure f <*> x = pure (($) f) <*> x -- identical
+pure f <*> x = pure ($) <*> pure f <*> x -- homomorphism
+pure f <*> x = pure (flip ($)) <*> x <*> pure f -- flip arguments
+```
+
diff --git a/_sass/_base.scss b/_sass/_base.scss
index dc81032..5c06995 100644
--- a/_sass/_base.scss
+++ b/_sass/_base.scss
@@ -224,7 +224,11 @@ pre {
font-family: 'Ubuntu Light';
src: url(fonts/Ubuntu-Light_gdi.woff);
}
+//@font-face {
+ //font-family: 'Ubuntu Mono';
+ //src: url(fonts/UbuntuMono-Regular_gdi.woff);
+//}
@font-face {
- font-family: 'Ubuntu Mono';
- src: url(fonts/UbuntuMono-Regular_gdi.woff);
+ font-family: Mononoki;
+ src: url(fonts/mononoki-Regular.woff);
}
diff --git a/_sass/_syntax-highlighting.scss b/_sass/_syntax-highlighting.scss
index c165e65..1742a20 100644
--- a/_sass/_syntax-highlighting.scss
+++ b/_sass/_syntax-highlighting.scss
@@ -5,7 +5,7 @@
/* ----------------------------------------------------------*/
pre, code {
- font-family: 'Ubuntu Mono';
+ font-family: 'Mononoki';
font-size: 11pt;
overflow-x: auto;
}
@@ -80,4 +80,4 @@ code {background: #fff; padding: 2px 4px; border-radius: 3px; border: 1px solid
.highlight .vg { color: #c82829 } /* Name.Variable.Global */
.highlight .vi { color: #c82829 } /* Name.Variable.Instance */
.highlight .il { color: #f5871f } /* Literal.Number.Integer.Long */
-.highlight .lineno {user-select: none; -moz-user-select: none; -webkit-user-select: none;}
\ No newline at end of file
+.highlight .lineno {user-select: none; -moz-user-select: none; -webkit-user-select: none;}
diff --git a/css/fonts/mononoki-Regular.ttf b/css/fonts/mononoki-Regular.ttf
new file mode 100644
index 0000000..9510ac8
Binary files /dev/null and b/css/fonts/mononoki-Regular.ttf differ
diff --git a/css/fonts/mononoki-Regular.woff b/css/fonts/mononoki-Regular.woff
new file mode 100644
index 0000000..67d3e8c
Binary files /dev/null and b/css/fonts/mononoki-Regular.woff differ