import - Remote syntactic sugar does not work for BigInt in Scala -



import - Remote syntactic sugar does not work for BigInt in Scala -

i have syntacticsugar class utilize import syntactic sugar on elliptic curve in files.

class syntacticsugar[point](curve : curve[point]) { case class ellipticoperand (p : point) { def + (q : => point) = curve.sum(p,q) def * (n : => bigint) = curve.times(p,n) } implicit def pointtooperand(p : point) = ellipticoperand(p) case class ellipticmultiplier (n : bigint) { def * (p : => point) = curve.times(p,n) } implicit def biginttooperand (n : bigint) = ellipticmultiplier(n) case class ellipticint (n : int) { def * (p : => point) = curve.times(p,bigint(n)) } implicit def inttooperand (n : int) = ellipticint(n) }

i utilize follow :

trait curve[t] { def sum(p: t, q: t): t def times(p: t, n: int): t } // dummy implementation jasper-m (thanks) class pointcurve extends curve[point] { override def sum(p: point, q: point) = point(p.x+q.x, p.y+q.y) override def times(p: point, n: int) = point(p.x*n, p.y*n) }

...

val sugar = new syntacticsugar(curve) import sugar._

the thing if want 2 * p p : point doesn't work, whereas p * 2 , p + p fine.

the compiler says overloaded method value * alternatives (...) cannot applied (point) * p

if sugar pasted in same file instead of beingness imported, works perfectly.

how ?

scala import syntactic-sugar

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -