Scala inner class typing
<p>Suppose I have the following:</p>

<pre><code>class Deck[+T] {
    class Card(value: T)
    class Pile(val cards: List[Card]) {
        val deck = Deck.this
        def shuffle(shuffler: Shuffler): shuffler.shuffle(this)
    }
}

trait Shuffler {
    def shuffle[T](pile: Deck[T]#Pile): pile.type
}

object Shuffler {
    def randomShuffler(r: Random): Shuffler = new Shuffler {
        override def shuffle[T](pile: Deck[T]#Pile): pile.deck.Pile = {
            new pile.deck.Pile(r.shuffle(pile.cards))
        }
    }
}
</code></pre>

<p>Is it possible to do the same thing without having the <code>val deck</code> declaration in <code>Pile</code>?  Also, is it possible to do the same thing without the <code>T</code> declaration in <code>shuffle()</code>?</p>

<p>I had been playing around with things such as <code>pile: x.Pile forSome {val x: Deck[_]}</code>, but they don't seem to compile due to typing issues (read: me not fully understanding semantics therein), and I'm trying to avoid rewriting <code>Shuffler</code> to, say, work with raw lists instead (how do I express that, anyways?  <code>List[Deck[T]#Card]</code> is not quite there, since I want lists of <code>Card</code>s from the same <code>Deck</code>).</p>