Skip to content
0:00 / 0:00

#typeclasses#implicits#scala

Tutorial: Typeclasses in Scala with Dan Rosen

InfoQ

234K subscribers • 65 videos on Hallway • Conference channel

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Dan Rosen

Intermediate. Assumes working knowledge.

44K views14 years ago2 recommendations

Programming languagesSoftware designScalaDesign patternsFunctional programming

Dan Rosen explains the typeclass design pattern in Scala and how to implement it using implicits for modular software architecture.

In this video tutorial, I'll go over the "typeclass" design pattern in Scala, a very powerful technique for keeping your software architectures modular, decoupled and open to extension. Originally implemented as a Haskell language feature, the typeclass pattern in Scala leverages implicits to achieve additional flexibility and control. This video is aimed at developers with some basic experience in Scala and assumes a bit of background with algebraic data types (sealed traits and case classes), implicits and general object-oriented design. ** for more free Scala resources, head to marakana.com/s/tags/scala

Why it's here

2 people recommend this

What people say. Recommended as an excellent, easy-to-follow introduction to typeclasses and implicits in Scala.

u/fokot2in r/scala • Recommends

On “Starting to scala”

…ritance`. And how it influence the code. It is often compared to `traits` but it is quite different. `Type classes` are implemented in scala using `implicits`. So learn them too. `Implicits` might be used for more things than `type classes` (you do not need to learn all of them, just be aware of that). This video is really good intro to them [video And these are some patterns https://github.com/fokot/scala-adventures/blob/master/docs/type-classes.md and workshop https://github.com/fokot/scala-adventures/blob/master/docs/type-classes-workshop.md I wrote for them. Other then type classes it is all about writing code as much as possible in immutable fashion…

u/fokot2in r/scala • Recommends

On “As an experienced programmer but beginner in Scala what are the most important concepts to learn and in what order?”

Definitely learn type classes as soon as possible. When doing so you will also learn implicits. You will need type classes at least in working with JSON even if you do not decide to go FP path. And it is also very different concept to the OO. They will be greatly simplified in Scala 3 but it is still useful. Look at this video [video Also I love this https://underscore.io/books/shapeless-guide/ free book about shapeless, this is another thing you will probably not use but is nice eye opener in what is possible and why there are other libraries like Magnolia or Chimney

u/fokot2in r/scala • Recommends

On “Understanding FP side of scala”

It depends what are the problems you try to solve with FP. Do you have problems with List/Either/Option or Try.. Or with monads and cats? Or with effects? My advice is to study the concrete problem at hand, read blogs, try to solve it nicely and slowly your problem will disappear. This is also nice video to understand typeclasses [video This is good free book not just about cats https://books.underscore.io/scala-with-cats/.

u/pafagaukurinnin r/scala • Recommends

On “As an experienced programmer but beginner in Scala what are the most important concepts to learn and in what order?”

> [video A nice and easy introduction to type classes. But the amount of vocal fry the guy uses is frightening.