title: Type Level Programming in Scala
body: <p>I wanted to get deeper into type level programming in Scala and I started doing some small exercises. I started with an implementation of Peano numbers at the type level. Here is the code below!</p>
  
  <pre><code>sealed trait PeanoNumType { // Type at the end indicates to the reader that we are dealing with types
    type plus[That &lt;: PeanoNumType] &lt;: PeanoNumType
  }
  
  sealed trait ZeroType extends PeanoNumType {
    type plus[That &lt;: PeanoNumType] = That
  }
  
  sealed trait NextType[This &lt;: PeanoNumType] extends PeanoNumType {
     type plus[That &lt;: PeanoNumType] = NextType[This#plus[That]]
  }
  </code></pre>
  
  <p>Now the question is, what would the above implementation buy me? How can I make use of it?</p>