title: How does Scala deal with recursive return types?
body: <p>In OCaml there's this thing called 'rectype' which allows recursive return-types. To illustrate what I mean by that here's a method with such a type:</p>
  
  <pre><code>def foo(n: Int)(i: Int): ??? = {
    val m = n + i
    (foo(m), m)
  }
  </code></pre>
  
  <p>The question is; what do you put in <code>???</code>'s place? Looking at the code you'd think it's something like:</p>
  
  <pre><code>Int =&gt; Int =&gt; (Int =&gt; (Int =&gt; (Int =&gt; (Int =&gt; ... , Int)
  </code></pre>
  
  <p>Why? Because the type of <code>foo(m)</code> is <code>Int =&gt; (Int =&gt; rep, Int)</code> where <code>rep</code> in the tuple is the repeated structure.</p>
  
  <p>Is there a way to do this?</p>