on master help sign in
added instance declarations of complex a for class eq and show
commitc31ae84bed934d0a96f32877796782f9c3b6fafb authorMekeor Melire <mekeor@ymail.com> dateFri 24 Feb 2012, 15:20 (15 years ago) parent30ca781
1 file changed+8
lib/prelude/complex.idr+8
lib/prelude/complex.idr+8
@@ -15,6 +15,14 @@ imagPart : Complex a -> a
1515imagPart (r:+i) = i
1616
1717
18+------------------------------ Instances
19+
20+instance Eq a => Eq (Complex a) where
21+ (==) a b = realPart a == realPart b && imagPart a == imagPart b
22+
23+instance Show a => Show (Complex a) where
24+ show (r:+i) = "("++show r++":+"++show i++")"
25+
1826------------------------------ Polarform
1927
2028mkPolar : Float -> Float -> Complex Float