Copyright Noel Welsh and Dave Gurnell, 2014-2021.
Artwork by Jenny Clements.
Published by Underscore Consulting LLP.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Scala with Cats teaches core functional abstractions of monoids, functors, monads, and applicative functors using the Cats library and a number of case studies.
The build requires a lot of heavy machinery:
texlive, node, java, scala, and pandoc and pandoc-crossref.
The simplest way to build it is to use Docker Compose
with the provided shell scripts, Dockerfile, and docker-compose.yaml:
-
install Docker Compose (
brew install docker-composeon OS X; or download from docker.com); and -
run
go.sh(ordocker-compose run book bashifgo.shdoesn't work).
This will open a bash shell running inside the Docker container
that contains all the dependencies to build the book.
From the shell run sbt to open an SBT prompt,
from which you can issue the following commands:
pdfbuilds a PDF version indist/scala-with-cats.pdf;htmlbuilds an HTML version indist/scala-with-cats.html;epubbuilds an ePub version indist/scala-with-cats.epub;allbuilds all three versions.
The pdf, html, and epub commands are each made of three smaller commands:
{foo}Setupcreates temp directories and builds JS/CSS prerequisites for the HTML/ePub versions;mdocruns the files insrc/pagesthrough mdoc to compile and run the Scala snippets;{foo}Pandocruns the output ofmdocthrough pandoc to produce the output.
There are also tex and json commands
(and commands like texSetup, jsonPandoc, and so on)
that build a LaTeX version of the book and a Pandoc AST respectively.
These are useful for debugging the build.
If you spot a typo or mistake, please feel free to fork the repo and submit a Pull Request. Add yourself to contributors.md to ensure we credit you for your contribution.
If you don't have time to submit a PR or you'd like to suggest a larger change to the content or structure of the book, please raise an issue instead.
