fork(1) download
  1. trait TaskDef {
  2. type Arguments <: AnyVal
  3. type Result <: AnyVal
  4. }
  5.  
  6. trait TaskInst[DefT <: TaskDef] {
  7. def definition: DefT
  8. def arguments: DefT#Arguments
  9. }
  10.  
  11. object Main extends App {
  12. object MyTaskDef extends TaskDef {
  13. override type Arguments = Int
  14. override type Result = Double
  15. }
  16. object MyTaskInst extends TaskInst[MyTaskDef.type] {
  17. override def definition = MyTaskDef
  18. override def arguments = 42
  19. }
  20. println(MyTaskInst.definition)
  21. println(MyTaskInst.arguments)
  22. }
Success #stdin #stdout 0.4s 322240KB
stdin
Standard input is empty
stdout
Main$MyTaskDef$@a30797
42