Skip to content

Instantly share code, notes, and snippets.

@soc
Created October 21, 2011 16:46
Show Gist options
  • Save soc/1304297 to your computer and use it in GitHub Desktop.
Save soc/1304297 to your computer and use it in GitHub Desktop.
package metascala.test
object UnitsTest extends App {
import metascala.Units._
val length1 = m(23)
val length2 = m(17)
val area: Area = length1 * length2 // Works, Quantity[_2, _0]
val time = s(42)
val foo: Foo = time * length1 // Works, Quantity[_1, _1]
//val speed: Speed = length1 / time // Doesn't work, Quantity[_1, _1#Neg]
/*
type mismatch;
found :
metascala.Units.Quantity[metascala.Subtractables.-[metascala.Integers._1,metascala.Integers._0],
metascala.Subtractables.-[metascala.Integers._0,metascala.Integers._1]]
required:
metascala.Units.Speed
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment