Chapter 7
- In Scala, Rich Wrapper is a pattern that allows you to simulate method injection into classes.
- The pattern is implemented in Scala using the implicit conversions mechanism. Whenever you are trying to call a method on a class that doesn't have this method, the compiler tries to convert the instance of that class into another class that has this method.
- See the explanation in the Intuition section in Chapter 7.
- The motivation behind the type class pattern is to separate the effect types from their behaviour so that it is possible to define new behaviours and inject them into existing type classes based on different scenarios that arise when performing functional programming.
- Yes, imperative languages do have type classes. However, in general, they lack mechanisms for their convenient usage.