Skip to content

A series of short Scala lessons that cover a variety of topics related to functional programming. These lessons are based in part on the books that were open-sourced by underscore.io and they can be considered an abridged (and not as detailed) version of that material.

Notifications You must be signed in to change notification settings

lu4nm3/scala-lessons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scala Lessons

These are a series of short lessons that cover various topics of the Scala programming language, especially as it relates to functional programming. The lessons are based in part on the open source books by underscore.io along with additional material and examples. They are by no means meant to provide an exhaustive overview the entirety of Scala but rather on what I felt were some of the more practical aspects of the language and of functional programming that you might use your real-world, day-to-day work.

Setup

You can jump right in and start going through the lessons starting at the beginning or jumping around to the topics that interest you. I recommend doing this directly from GitHub as it offers pretty good support for markdown and the lessons themselves have navigation links that let you move around pretty easily.

In addition, you can also run all of the code snippets on the REPL. I encourage you to do this and to play around with the examples as it really helps to learn the concepts.

SBT

If you want to interact with the examples presented in this project using the REPL, you will need to install SBT. Follow the instructions listed here based on your local environment: https://www.scala-sbt.org/download.html

If you're running on Mac, you can use Homebrew to install SBT:

$ brew install sbt@1

Ammonite

The REPL that I used in the examples throughout the lesson was Ammonite (denoted by the @) due to the many improvements that it brings over the standard REPL. It works pretty well for the most part but once in a while you might run into a few minor quirks.

To set it up on your local environment, simply run the following command:

$ sudo sh -c '(echo "#!/usr/bin/env sh" && curl -L https://github.com/lihaoyi/Ammonite/releases/download/1.3.2/2.12-1.3.2) > /usr/local/bin/amm && chmod +x /usr/local/bin/amm' && amm

You will need to clone a copy of this project as the build.sbt includes configurations to load the necessary dependencies that the lessons need:

$ git clone https://github.com/lu4nm3/scala-lessons.git

Afterwards, cd into the root directory and run sbt test:run to start a new Ammonite shell session:

$ cd scala-lessons/
$ sbt test:run
...
@

Default REPL

Alternatively, you can use the default Scala REPL by running sbt console from within the root directory of the project which will start a new shell session:

$ sbt console
...
scala> 

Table of Contents

  1. Basics

    1. Super Basics
    2. Functions
    3. Collections
    4. Classes, Traits, & Objects
    5. Pattern Matching
  2. Implicits

    1. Parameters
    2. Conversions
    3. Classes
    4. Nested Conversions
  3. Type Classes

    1. Polymorphism
    2. The Type Class
    3. Instances
    4. Interface Objects
    5. Interface Syntax
    6. Context Bounds
    7. Scope & Packaging
    8. Recursive Implicit Resolution
  4. Functional Programming

    1. Basics

      1. Higher-Kinded Types
      2. Monoids
      3. Semigroups
      4. Functors
    2. Monads

      1. Monads
      2. Id
      3. MonadError
      4. Eval
      5. Writer
      6. Reader
      7. Kleisli
      8. State
      9. Monad Transformers
    3. Applicatives

      1. Semigroupal
      2. Validated
      3. Apply & Applicative
      4. Foldable
      5. Traverse
    4. Patterns

      1. MTL

About

A series of short Scala lessons that cover a variety of topics related to functional programming. These lessons are based in part on the books that were open-sourced by underscore.io and they can be considered an abridged (and not as detailed) version of that material.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published