Scala with Cats Code

Sandbox project for the exercises in the book Scala with Cats. Based on the cats-seed.g8 template by Underscore.

Copyright Anonymous Aardvark. Licensed CC0 1.0.

Gitter

Getting Started

You will need to have Git, Java 8, and SBT installed. You will also need an internet connection to run the exercises. All other dependencies are either included with the repo or downloaded on demand during compilation.

Start SBT using the sbt command to enter SBT's interactive mode (> prompt):

$ sbt
[info] Loading global plugins from <DIRECTORY>
[info] Loading project definition from <DIRECTORY>
[info] Set current project to <PROJECT_NAME>

>

From the SBT prompt you can run the code in Main.scala:

> run
[info] Updating {file:<DIRECTORY>}cats-sandbox...
[info] Resolving jline#jline;2.14.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to <DIRECTORY>...
[info] Running sandbox.Main
Hello Cats!
[success]

You can also start a Scala console (scala> prompt) to play with small snippets of code:

> console
[info] Starting scala interpreter...
[info]
Welcome to Scala 2.12.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.

scala> import cats._, cats.implicits._, cats.data._
import cats._
import cats.implicits._
import cats.data._

scala> "Hello " |+| "Cats!"
res0: String = Hello Cats!

scala>

Press Ctrl+D to quit the Scala console and return to SBT interactive mode.

Press Ctrl+D again to quit SBT interactive mode and return to your shell.

Notes on Editors and IDEs

If you don't have a particular preference for a Scala editor or IDE, we strongly recommend you do the exercises for this course using the Atom editor and a Linux or OS X terminal. See the instructions below to get started.

If you want to use Scala IDE for Eclipse, we recommend using sbteclipse. Follow the instructions on the sbteclipse web page to install it as a global SBT plugin.

If you want to use IntelliJ IDEA, follow the instructions for Importing an SBT Project in the IntelliJ online documentation.

Asking Questions

If you want to discuss the content or exercises with the authors, join us in our chat room on Gitter.