/typeclassopedia

My tinkering to understand scalaz and the typeclassopedia

Primary LanguageScalaMIT LicenseMIT

Typeclassopedia

Gitter Build Status Codacy Badge

This project aims to be a simple implementation of the Typeclassopedia in Scala. (If you find a simpler way to express something then please report it or send a pull request.)

Some people learn better by seeing things in code, with examples, which is why I started doing this. The tests are intended to be examples using typical types like Option and List, but also a custom type, Blub, to show that new types can make use of the type classes defined here.

How to Start

I suggest you start with Functor as it is the simplest class to study, then Applicative, Monad, Semigroup and Monoid. Then have a look at Validation which is not part of the Typeclassopedia but its useful.

Do not start with Category, Arrow or Kleisli unless you've understood the above, your brain with melt and kittens will have their toys taken away. Before attempting to grok Category and its subtypes (Arrow), read Introduction to Category Theory in Scala by Heiko Seeberger.

But before you do any of that, you need to understand type classes in scala.

The tests serve as examples of use.

Exercises

There is only one exercise.

  1. Check out the project
  2. Delete src/main/scala/org/typeclassopedia/std
  3. Delete src/test/scala/org/typeclassopedia/Blub.scala (except for the case class itself)
  4. Make all the tests pass again

Further Reading

Books

Talks