From 9095cc139d4840e3361ef4516a7f6e3cb97cdeb2 Mon Sep 17 00:00:00 2001 From: Noel Welsh Date: Mon, 22 Jan 2024 12:52:08 +0000 Subject: [PATCH] Assorted structural changes - Reorder content - Update copyright - Minor tweaks to formatting, titles --- build.sbt | 40 +++++++++++++++++++++++++----------- src/meta/metadata.yaml | 8 ++++---- src/pages/intro/index.md | 2 +- src/pages/parts/part1.md | 2 +- src/pages/parts/part2.md | 2 +- src/pages/parts/part3.md | 2 +- src/pages/parts/solutions.md | 2 ++ src/pages/preface/preface.md | 8 ++++++++ src/templates/template.tex | 2 +- 9 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 src/pages/parts/solutions.md diff --git a/build.sbt b/build.sbt index fd2fc144..e44c6867 100644 --- a/build.sbt +++ b/build.sbt @@ -40,25 +40,18 @@ lazy val pages = List( "intro/index.md", "intro/three-levels.md", "intro/what-is-fp.md", + // Part 1: Foundations "parts/part1.md", "adt/index.md", + // ADTs "adt/scala.md", "adt/structural-recursion.md", "adt/structural-corecursion.md", "adt/applications.md", "adt/algebra.md", "adt/conclusions.md", - "adt-interpreters/index.md", - "adt-interpreters/regexp.md", - "adt-interpreters/reification.md", - "adt-interpreters/tail-recursion.md", - "adt-interpreters/conclusions.md", - "adt-optimization/index.md", - "adt-optimization/algebra.md", - "adt-optimization/stack-reify.md", - "adt-optimization/stack-machine.md", - // "adt-optimization/effects.md", - "adt-optimization/conclusions.md", + // Objects as Codata + // Contextual Abstraction "type-classes/index.md", "type-classes/anatomy.md", "type-classes/implicits.md", @@ -67,16 +60,21 @@ lazy val pages = List( "type-classes/equal.md", "type-classes/instance-selection.md", "type-classes/summary.md", + // Part 2: Type Classes + "parts/part2.md", + // Monoid "monoids/index.md", "monoids/cats.md", "monoids/applications.md", "monoids/summary.md", + // Functor "functors/index.md", "functors/cats.md", "functors/contravariant-invariant.md", "functors/contravariant-invariant-cats.md", "functors/partial-unification.md", "functors/summary.md", + // Monad "monads/index.md", "monads/cats.md", "monads/id.md", @@ -90,18 +88,36 @@ lazy val pages = List( "monads/summary.md", "monad-transformers/index.md", "monad-transformers/summary.md", + // Applicative "applicatives/index.md", "applicatives/semigroupal.md", "applicatives/examples.md", "applicatives/parallel.md", "applicatives/applicative.md", "applicatives/summary.md", + // Parallel + // Traverse "foldable-traverse/index.md", "foldable-traverse/foldable.md", "foldable-traverse/foldable-cats.md", "foldable-traverse/traverse.md", "foldable-traverse/traverse-cats.md", "foldable-traverse/summary.md", + // Part 3: Interpreters + "parts/part3.md", + "adt-interpreters/index.md", + "adt-interpreters/regexp.md", + "adt-interpreters/reification.md", + "adt-interpreters/tail-recursion.md", + "adt-interpreters/conclusions.md", + "adt-optimization/index.md", + "adt-optimization/algebra.md", + "adt-optimization/stack-reify.md", + "adt-optimization/stack-machine.md", + // "adt-optimization/effects.md", + "adt-optimization/conclusions.md", + // Part 4: Craft + // Part 5: Case Studies "parts/part2.md", "case-studies/testing/index.md", "case-studies/map-reduce/index.md", @@ -124,7 +140,7 @@ lazy val pages = List( // "case-studies/parser/transforms.md", // "case-studies/parser/applicative.md", - "parts/part3.md", + "parts/solutions.md", "solutions.md", "links.md", "parts/part4.md" diff --git a/src/meta/metadata.yaml b/src/meta/metadata.yaml index 54cdda92..84d425d2 100644 --- a/src/meta/metadata.yaml +++ b/src/meta/metadata.yaml @@ -1,9 +1,9 @@ --- -title: "Scala with Cats" -author: "Noel Welsh with Dave Gurnell" -date: "June 2023" +title: "Functional Programming Strategies in Scala with Cats" +author: "Noel Welsh" +date: "Jan 2024" tocDepth: 3 -copyright: "2014-23" +copyright: "2014-24" figPrefixTemplate: "$$i$$" eqnPrefixTemplate: "$$i$$" tblPrefixTemplate: "$$i$$" diff --git a/src/pages/intro/index.md b/src/pages/intro/index.md index 33ec6e42..3ba215ab 100644 --- a/src/pages/intro/index.md +++ b/src/pages/intro/index.md @@ -1,4 +1,4 @@ -# Introduction +# Thinking About Thinking About Code This is a book on strategies to create code in a functional programming (FP) style, seen through a Scala lens. If you understand most of the mechanics of Scala, but feel there is something missing in your understanding of how to use the language effectively, this book might be for you. If you don't know so much Scala, but are prepared to learn it as part of learning about functional programming, this book might also work. It covers the usual functional programming abstractions like monads and monoids, but more than that it tries to teach you how to think and program like a functional programmer. It's a book as much about process as it is about the code that results from process, and in particular it focuses on what I can metacognitive programming strategies. diff --git a/src/pages/parts/part1.md b/src/pages/parts/part1.md index e1c813e6..5e08d58c 100644 --- a/src/pages/parts/part1.md +++ b/src/pages/parts/part1.md @@ -1,2 +1,2 @@ \partimage[width=.5\linewidth]{src/pages/parts/part1.png} -\part{Theory} +\part{Foundations} diff --git a/src/pages/parts/part2.md b/src/pages/parts/part2.md index 647389f1..a118f872 100644 --- a/src/pages/parts/part2.md +++ b/src/pages/parts/part2.md @@ -1,2 +1,2 @@ \partimage[width=.5\linewidth]{src/pages/parts/part2.png} -\part{Case Studies} +\part{Type Classes} diff --git a/src/pages/parts/part3.md b/src/pages/parts/part3.md index 5aa84e71..fc2a2ca6 100644 --- a/src/pages/parts/part3.md +++ b/src/pages/parts/part3.md @@ -1,2 +1,2 @@ \partimage[width=.5\linewidth]{src/pages/parts/part3.png} -\part{Solutions to Exercises} +\part{Interpreters} diff --git a/src/pages/parts/solutions.md b/src/pages/parts/solutions.md new file mode 100644 index 00000000..5aa84e71 --- /dev/null +++ b/src/pages/parts/solutions.md @@ -0,0 +1,2 @@ +\partimage[width=.5\linewidth]{src/pages/parts/part3.png} +\part{Solutions to Exercises} diff --git a/src/pages/preface/preface.md b/src/pages/preface/preface.md index 79aec361..e1be569e 100644 --- a/src/pages/preface/preface.md +++ b/src/pages/preface/preface.md @@ -1,5 +1,13 @@ # Preface {-} +## Functional Programming Strategies {-} + +This book builds on the bones of an earlier book, *Scala with Cats*. +This preface will be completed when this book near completion. + + +## Scala with Cats {-} + The aims of this book are two-fold: to introduce monads, functors, and other functional programming patterns as a way to structure program design, diff --git a/src/templates/template.tex b/src/templates/template.tex index 73774c46..548d64dc 100644 --- a/src/templates/template.tex +++ b/src/templates/template.tex @@ -406,7 +406,7 @@ $if(blackandwhiteprintable)$ $else$ -\includepdf[pages={1},noautoscale]{src/covers/pdf-cover.pdf} +\includepdf[pages={1},noautoscale]{src/covers/pdf-cover-2nd-ed.pdf} \clearpage $endif$