Skip to content

Commit ace8e90

Browse files
authored
Adding TOC to Readme
1 parent 1e0be65 commit ace8e90

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

‎README.md‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@
55

66
Functional patterns for Java 8
77

8-
Background
8+
#### Table of Contents
9+
10+
- [Background](#background)
11+
- [Installation](#installation)
12+
- [Examples](#examples)
13+
- [ADTs](#adts)
14+
- [HLists](#hlists)
15+
- [Tuples](#tuples)
16+
- [HMaps](#hmaps)
17+
- [Either](#either)
18+
- [License](#license)
19+
20+
<a name="background">Background</a>
921
----------
1022

1123
Lambda was born out of a desire to use some of the same canonical functions (e.g. `unfoldr`, `takeWhile`, `zipWith`) and functional patterns (e.g. `Functor` and friends) that are idiomatic in other languages and make them available for Java.
@@ -22,7 +34,7 @@ Generally, everything that lambda produces is lazily-evaluated (except for termi
2234

2335
Although the library is currently (very) small, these values should always be the driving forces behind future growth.
2436

25-
Installation
37+
<a name="installation">Installation</a>
2638
------------
2739

2840
Add the following dependency to your:
@@ -44,7 +56,7 @@ Add the following dependency to your:
4456
```
4557

4658

47-
Examples
59+
<a name="examples">Examples</a>
4860
--------
4961

5062
First, the obligatory `map`/`filter`/`reduce` example:
@@ -124,12 +136,12 @@ And have fun with 3s:
124136

125137
Check out the [tests](https://github.com/palatable/lambda/tree/master/src/test/java/com/jnape/palatable/lambda/functions/builtin) or [javadoc](http://palatable.github.io/lambda/javadoc/) for more examples.
126138

127-
ADTs
139+
<a name="adts">ADTs</a>
128140
----
129141

130142
In addition to the functions above, lambda also supports a few first-class [algebraic data types](https://www.wikiwand.com/en/Algebraic_data_type).
131143

132-
### Heterogeneous Lists (HLists)
144+
### <a name="hlists">Heterogeneous Lists (HLists)</a>
133145

134146
HLists are type-safe heterogeneous lists, meaning they can store elements of different types in the same list while facilitating certain type-safe interactions.
135147

@@ -145,7 +157,7 @@ The following illustrates how the linear expansion of the recursive type signatu
145157
//nil.head() won't type-check
146158
```
147159

148-
#### Tuples
160+
#### <a name="tuples">Tuples</a>
149161

150162
One of the primary downsides to using `HList`s in Java is how quickly the type signature grows.
151163

@@ -188,7 +200,7 @@ Finally, all `Tuple*` classes are instances of both `Functor` and `Bifunctor`:
188200
System.out.println(mappedTuple3._3()); // prints 2
189201
```
190202

191-
### Heterogeneous Maps
203+
### <a name="hmaps">Heterogeneous Maps</a>
192204

193205
HMaps are type-safe heterogeneous maps, meaning they can store mappings to different value types in the same map; however, whereas HLists encode value types in their type signatures, HMaps rely on the keys to encode the value type that they point to.
194206

@@ -203,7 +215,7 @@ HMaps are type-safe heterogeneous maps, meaning they can store mappings to diffe
203215
Optional<Integer> anotherIntValue = hmap.get(anotherIntKey); // Optional.empty
204216
```
205217

206-
### Either
218+
### <a name="either">Either</a>
207219

208220
Binary tagged unions are represented as `Either<L, R>`s, which resolve to one of two possible values: a `Left` value wrapping an `L`, or a `Right` value wrapping an `R` (typically an exceptional value or a successful value, respectively).
209221

@@ -222,7 +234,7 @@ Rather than supporting explicit value unwrapping, `Either` supports many useful
222234

223235
Check out the tests for [more examples](https://github.com/palatable/lambda/blob/master/src/test/java/com/jnape/palatable/lambda/adt/EitherTest.java) of ways to interact with `Either`.
224236

225-
License
237+
<a name="license">License</a>
226238
-------
227239

228240
_lambda_ is part of [palatable](http://www.github.com/palatable), which is distributed under [The MIT License](http://choosealicense.com/licenses/mit/).

0 commit comments

Comments
 (0)