Show instance for Modulo
commit5a26a74ada26baad4b1c0a44a3504ede858f1b7c
authorBenjamin Saunders <besaunde@sfu.ca>
dateThu 20 Dec 2012, 19:16 (14 years ago)
parent279b02d
lib/Prelude.idr+3
@@ -32,6 +32,9 @@ instance Show Nat where
3232instance Show Int where
3333 show = prim__intToStr
3434
35+instance Show (Modulo (S n)) where
36+ show = modToStr
37+
3538instance Show Integer where
3639 show = prim__bigIntToStr
3740
lib/Prelude/Modular.idr+4
@@ -23,6 +23,10 @@ public
2323modDiv : Modulo n -> Modulo n -> Modulo n
2424modDiv (MkModulo x) (MkModulo y) = MkModulo (bitsUDiv x y)
2525
26+public
27+modToStr : Modulo n -> String
28+modToStr (MkModulo x) = bitsToStr x
29+
2630instance Num (Modulo (S n)) where
2731 (+) = modAdd
2832 (-) = modSub