Skip to content

Commit

Permalink
Link to relevant Const doc from doc of Traverse (#3065)
Browse files Browse the repository at this point in the history
  • Loading branch information
LPTK authored and LukaJCB committed Sep 16, 2019
1 parent 5d07788 commit f727b5d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/src/main/tut/typeclasses/traverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ def foldMap[F[_]: Traverse, A, B: Monoid](fa: F[A])(f: A => B): B =
Traverse[F].traverse[Const[B, *], A, B](fa)(a => Const(f(a))).getConst
```

This works because `Const[B, *]` is an `Applicative` if `B` is a `Monoid`, as explained in [the documentation of `Const`](const.html#example-2-traverse).

## Further Reading

* [The Essence of the Iterator Pattern][iterator] - Gibbons, Oliveira. JFP 2009.
Expand Down

0 comments on commit f727b5d

Please sign in to comment.