I'm studying type-leve programming in scala from https://apocalisp.wordpress.com/2010/06/21/type-level-programming-in-scala-part-4d-peano-arithmetic/. And get error in Mod

type Mod[A <: Nat, B <: Nat] = A#FoldR[_0, Nat, ModFold[B]] type ModFold[By <: Nat] = Fold[Nat, Nat] { type Wrap[Acc <: Nat] = By#Compare[Acc]#eq type Apply[N <: Nat, Acc <: Nat] = Wrap[Succ[Acc]]#IF[_0, Succ[Acc], Nat] } toBoolean[ Eq[ Mod[_4, _6], _3] ] Error:(110, 18) could not find implicit value for parameter b: BoolRep[Eq[Mod[_4,_6],_3]] toBoolean[ Eq[ Mod[_4, _6], _3] ] ^

After that, I try some expression in scala repl,

implicitly[ModFold[_2]#Wrap[Succ[_1]]#IF[_0, Succ[_1], Nat] <:< Nat] // correct implicitly[ModFold[_2]#Apply[_1, _2] <:< Nat] // error, Cannot prove that Bool.this.IF[_0,Succ[_2],Nat] <:< Nat.

from my view, the first expression is just the second expression expand in manual.

How dose those happen and how can I get those correct?

I'm using scala 2.11