Skip to content

Instantly share code, notes, and snippets.

@ant8e
Created February 5, 2014 11:41
Show Gist options
  • Save ant8e/8821912 to your computer and use it in GitHub Desktop.
Save ant8e/8821912 to your computer and use it in GitHub Desktop.
sealed abstract trait MetricStyle
trait Gauge extends MetricStyle
trait Metric extends MetricStyle with MetricValue
class IntGauge extends Metric with Gauge {
type Value =Int
}
object MetricOp {
abstract class MetricOperation[+T <: Metric](val metric: T)
class IncOp[+T <: Metric](metric: T, val value : T#Value) extends MetricOperation[T](metric)
}
object Toto {
import MetricOp._
val g = new IntGauge
val t: IncOp[IntGauge] = new IncOp[g.type ](g,0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment