Type classes in Scala
问题 Having a background in Haskell I am currently trying to get familiar with Scala. I encountered some problems trying to translate a small, extensible expression language from Haskell into Scala. The underlying issue of writing a data type that is extensible with both new data-variants and operations is commonly known as the expression problem. My original solution in Haskell uses type classes and instance declarations with constraints. The base of my expression is defined as follows: module