How does `isInstanceOf` work?

isInstanceOf looks if there is a corresponding entry in the inheritance chain. The chain of A with T includes A, B and T, so a.isInstanceOf[B] must be true. edit: Actually the generated byte code calls javas instanceof, so it would be a instanceof B in java. A little more complex call like a.isInstanceOf[A with T] … Read more

Why is PartialFunction

Because in Scala (as in any Turing complete language) there is no guarantee that a Function is total. val f = {x : Int => 1 / x} That function is not defined at 0. A PartialFunction is just a Function that promises to tell you where it’s not defined. Still, Scala makes it easy … Read more

Impredicative types vs. plain old subtyping

You’re confusing impredicative types with existential types. Impredicative types allow you to put polymorphic values in a data structure, not arbitrary concrete ones. In other words [forall a. Num a => a] means that you have a list where each element works as any numeric type, so you can’t put e.g. Int and Double in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)