File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 11package strawman .collections
22
33import Predef .{augmentString => _ , wrapString => _ , _ }
4+ import scala .language .implicitConversions
45import scala .reflect .ClassTag
56
67/** A strawman architecture for new collections. It contains some
@@ -13,7 +14,17 @@ import scala.reflect.ClassTag
1314 */
1415object CollectionStrawMan1 {
1516
16- type LengthType = Long
17+ type LengthTypeUnderlying = Long
18+
19+ final case class LengthType (u : LengthTypeUnderlying ) extends AnyVal {
20+ def + (other : LengthType ) = LengthType (u + other.u)
21+ def - (other : LengthType ) = LengthType (u - other.u)
22+ def / (other : LengthType ) = LengthType (u / other.u)
23+ def * (other : LengthType ) = LengthType (u * other.u)
24+ }
25+
26+ implicit def intToLengthType (x : Int ): LengthType = LengthType (x)
27+ implicit def lengthTypeToLong (x : LengthType ): Long = x.u.toLong
1728
1829 /* ------------ Base Traits -------------------------------- */
1930
You can’t perform that action at this time.
0 commit comments