Skip to content

Instantly share code, notes, and snippets.

@BalmungSan
BalmungSan / Polymorphism.md
Last active September 11, 2024 00:00
Polymorphism in Scala.

Polymorphism in Scala

This document aims to show and compare three alternatives for achieving polymorphism in Scala.

  • Subtyping, common in object-oriented languages like Java.
  • Duck typing, common in dynamically typed languages like Python.
  • Typeclasses, common in functional languages like Haskell.

Additionally, when implementing the typeclass pattern in Scala,