@@ -16,7 +16,26 @@ fully interoperable with the combinators found in mainstream lens libraries.
1616
1717Examples can be found in the `examples` and `tests` folders.
1818
19−## Preliminaries
19+Table of contents
20+=================
21+
22+* [Preliminaries](#preliminaries)
23+* [Taxonomy of optics](#taxonomy-of-optics)
24+ * [Lenses](#lenses)
25+ * [By name](#by-name-1)
26+ * [By position](#by-position)
27+ * [By type](#by-type-1)
28+ * [By structure](#by-structure)
29+ * [Traversals](#traversals)
30+ * [By type](#by-type-2)
31+ * [By parameter](#by-parameter)
32+ * [By constraint](#by-constraint)
33+ * [Prisms](#prisms)
34+ * [By name](#by-name-2)
35+ * [By type](#by-type-3)
36+* [Contributors](#contributors)
37+
38+# Preliminaries
2039A typical module using `generic-lens` will usually have the following
2140extensions turned on:
2241```haskell
@@ -31,7 +50,7 @@ extensions turned on:
3150
3251# Taxonomy of optics
3352Here is a comprehensive list of the optics exposed by `generic-lens`. The
34−combinators each allows a different way of identifying certain parts of
53+combinators each allow a different way of identifying certain parts of
3554algebraic data types.
3655
3756## Lenses
@@ -80,7 +99,10 @@ error:
8099
81100For types with multiple constructors, we can still use `field` as long as all constructors contain the required field
82101```haskell
83−data Two = First { wurble :: String, banana :: Int } | Second { wurble :: String } deriving (Generic, Show)
102+data Two
103+ = First { wurble :: String, banana :: Int }
104+ | Second { wurble :: String }
105+ deriving (Generic, Show)
84106
85107>>> Second "woops" ^. field @"wurble"
86108"woops"
@@ -113,7 +135,9 @@ foo1 = Foo (Just 10)
113135foo2 :: Foo [] String
114136foo2 = foo1 & field @"foo" %~ (maybeToList . fmap show)
115137```
116−This example shows that higher-kinded parameters can also be changed (`Maybe` -> `[]`).
138+This example shows that higher-kinded parameters can also be changed (`Maybe`
139+-> `[]`). We turn a `Foo Maybe Int` into a `Foo [] String` by turning the inner
140+`Maybe Int` into a `[String]`.
117141
118142### By position
119143
@@ -304,7 +328,7 @@ error:
304328Duck 6
305329```
306330
307−## Contributors
331+# Contributors
308332
309333+ [Matthew Pickering](https://github.com/mpickering)
310334+ [Toby Shaw](https://github.com/TobyShaw)