1 import "JavaBuiltin" as Java
\r
5 class Additive a where
\r
8 instance Additive Double where
\r
9 x + y = Java.dadd x y
\r
11 instance Additive Integer where
\r
12 x + y = Java.iadd x y
\r
14 instance (Additive a, Additive b) => Additive (a,b) where
\r
15 (x1,y1) + (x2,y2) = (x1+x2,y1+y2)
\r
17 main = (1.0::Double,3::Integer) + (2.0::Double,4::Integer)
\r