• Stars
    star
    102
  • Rank 335,584 (Top 7 %)
  • Language
    Scala
  • License
    MIT License
  • Created over 11 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

My tinkering to understand the typeclassopedia.

Typeclassopedia

Gitter Build Status codecov

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.

Read The Road to the Typeclassopedia which I hope will be a gentle introduction to the ideas from examples rather than from theory.

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 it's useful.

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