Scala Generics Type Constraints
generics, scala, type-constraints
Solution
There is no type constraint called `<`.
`A <: B` means `A` is literally a subtype of `B` (where subtype is defined reflexively, meaning for any type `T` it is the case that `T <: T`).
`A <% B` means `A` is either a subtype of `B` or there is an implicit conversion from `A` to a distinct type `AA` for which `AA <: B`. This is called a "view bound."
`A >: B` means `A` is supertype of `B`.
Problem
I am reading Programming Scala right now. I just got through the chapter on implicit type conversion, where the `<%` symbol is introduced. There is also a `<:` symbol and a `<` symbol. Could someone please summarize the different type constraints? I am struggling with the difference between `<:` and `<` for instance. I am curious if there are any others I haven't covered yet.