Skip to content

Instantly share code, notes, and snippets.

View hugoferreira's full-sized avatar

Hugo Sereno Ferreira hugoferreira

View GitHub Profile
@hugoferreira
hugoferreira / gist:3861363
Created October 9, 2012 20:55 — forked from jcazevedo/gist:3849885
Simple Polymorphic Stack Machine
import scala.util.Random
object PStack {
type Any = PStack[_, _]
}
sealed trait PStack[A, B <: PStack.Any] {
def ++[C, D <: PStack.Any](op: Op[A, B, C, D]): PStack[C, D] = op.execute(this)
}