6 Folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

6.1 Introduction to Folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Focusing all elements of a container

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Collapsing the Set

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Collecting focuses as a list

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Using lenses as folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Composing folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Foundational fold combinators

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Exercises – Simple Folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

6.2 Custom Folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Mapping over folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Combining multiple folds on the same structure

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Exercises – Custom Folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

6.3 Fold Actions

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Writing queries with folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Does my fold contain a given element?

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Do ANY focuses match a predicate?

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Do ALL focuses match a predicate?

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Find the first element matching a predicate

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Does my fold have any elements or not?

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

How many focuses are there?

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

What’s the sum or product of my focuses?

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

What’s the first or last focus?

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Find the minimum or maximum focus

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Queries case study

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Folding with effects

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Combining fold results

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Using ‘view’ on folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Customizing monoidal folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Exercises – Fold Actions

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

6.4 Higher Order Folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Taking, Dropping

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Backwards

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

TakingWhile, DroppingWhile

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Exercises – Higher Order Folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

6.5 Filtering folds

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Filtered

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

Exercises – Filtering

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.

6.6 Fold Laws

This content is not available in the sample book. The book can be purchased on Leanpub at http://leanpub.com/optics-by-example.