1 import "JavaBuiltin" as Java
\r
6 class Additive a where
\r
9 class (Additive a) => Ring a where
\r
12 instance Additive Double where
\r
13 x + y = Java.dadd x y
\r
15 instance Ring Double where
\r
16 x * y = Java.dmul x y
\r
18 instance Additive Integer where
\r
19 x + y = Java.iadd x y
\r
21 instance Ring Integer where
\r
22 x * y = Java.imul x y
\r
24 main = (1.0 :: Double)*(2.0 :: Double)+(3.0 :: Double)*(4.0 :: Double)
\r