Questions tagged [value-class]
62 questions
0
votes
2 answers
Why doesn't this almost-identical value class work?
As promised at http://docs.scala-lang.org/overviews/core/value-classes.html, this works:
class Wrapper(val self: Int) extends AnyVal {
def toHexString: String = java.lang.Integer.toHexString(self)
}
println(12.toHexString)
But this doesn't…

Ben Kovitz
- 4,920
- 1
- 22
- 50
0
votes
1 answer
Expand type class operations on elements using macros
Assuming the following setup:
trait A[L] { def op(l1:L, l2:L): L }
trait E[L] { def op(l:L): L }
implicit def some2E[L:A](self:L) = new E[L] { def op(other:L) =
implicitly[A[L]].op(self,other) }
Is there a way to directly expand m op n to…

bnord
- 385
- 1
- 12