summaryrefslogtreecommitdiff
path: root/packages/base/src/Internal/Modular.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src/Internal/Modular.hs')
-rw-r--r--packages/base/src/Internal/Modular.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/base/src/Internal/Modular.hs b/packages/base/src/Internal/Modular.hs
index 239c742..f3c59a8 100644
--- a/packages/base/src/Internal/Modular.hs
+++ b/packages/base/src/Internal/Modular.hs
@@ -72,7 +72,7 @@ instance (Ord t, KnownNat m) => Ord (Mod m t)
72 where 72 where
73 compare a b = compare (unMod a) (unMod b) 73 compare a b = compare (unMod a) (unMod b)
74 74
75instance (Real t, KnownNat m, Integral (Mod m t)) => Real (Mod m t) 75instance (Integral t, Real t, KnownNat m, Integral (Mod m t)) => Real (Mod m t)
76 where 76 where
77 toRational x = toInteger x % 1 77 toRational x = toInteger x % 1
78 78
@@ -114,7 +114,7 @@ instance Show t => Show (Mod n t)
114 where 114 where
115 show = show . unMod 115 show = show . unMod
116 116
117instance forall n t . (Integral t, KnownNat n) => Num (Mod n t) 117instance (Integral t, KnownNat n) => Num (Mod n t)
118 where 118 where
119 (+) = l2 (\m a b -> (a + b) `mod` (fromIntegral m)) 119 (+) = l2 (\m a b -> (a + b) `mod` (fromIntegral m))
120 (*) = l2 (\m a b -> (a * b) `mod` (fromIntegral m)) 120 (*) = l2 (\m a b -> (a * b) `mod` (fromIntegral m))
@@ -159,11 +159,11 @@ instance KnownNat m => Element (Mod m Z)
159 m' = fromIntegral . natVal $ (undefined :: Proxy m) 159 m' = fromIntegral . natVal $ (undefined :: Proxy m)
160 160
161 161
162instance forall m . KnownNat m => CTrans (Mod m I) 162instance KnownNat m => CTrans (Mod m I)
163instance forall m . KnownNat m => CTrans (Mod m Z) 163instance KnownNat m => CTrans (Mod m Z)
164 164
165 165
166instance forall m . KnownNat m => Container Vector (Mod m I) 166instance KnownNat m => Container Vector (Mod m I)
167 where 167 where
168 conj' = id 168 conj' = id
169 size' = dim 169 size' = dim
@@ -203,7 +203,7 @@ instance forall m . KnownNat m => Container Vector (Mod m I)
203 fromZ' = vmod . fromZ' 203 fromZ' = vmod . fromZ'
204 toZ' = toZ' . f2i 204 toZ' = toZ' . f2i
205 205
206instance forall m . KnownNat m => Container Vector (Mod m Z) 206instance KnownNat m => Container Vector (Mod m Z)
207 where 207 where
208 conj' = id 208 conj' = id
209 size' = dim 209 size' = dim
@@ -311,7 +311,7 @@ lift2 f a b = vmod (f (f2i a) (f2i b))
311 311
312lift2m f a b = liftMatrix vmod (f (f2iM a) (f2iM b)) 312lift2m f a b = liftMatrix vmod (f (f2iM a) (f2iM b))
313 313
314instance forall m . KnownNat m => Num (Vector (Mod m I)) 314instance KnownNat m => Num (Vector (Mod m I))
315 where 315 where
316 (+) = lift2 (+) 316 (+) = lift2 (+)
317 (*) = lift2 (*) 317 (*) = lift2 (*)
@@ -321,7 +321,7 @@ instance forall m . KnownNat m => Num (Vector (Mod m I))
321 negate = lift1 negate 321 negate = lift1 negate
322 fromInteger x = fromInt (fromInteger x) 322 fromInteger x = fromInt (fromInteger x)
323 323
324instance forall m . KnownNat m => Num (Vector (Mod m Z)) 324instance KnownNat m => Num (Vector (Mod m Z))
325 where 325 where
326 (+) = lift2 (+) 326 (+) = lift2 (+)
327 (*) = lift2 (*) 327 (*) = lift2 (*)