diff options
author | Alberto Ruiz <aruiz@um.es> | 2016-02-09 13:04:58 +0100 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2016-02-09 13:04:58 +0100 |
commit | c84049d82c9354bda7843c0b83f50c56f75b92e2 (patch) | |
tree | b464f1572fc2dd9b2262403140d6ff76c1a58227 /packages/base/src/Internal | |
parent | 0a6e494d3c7c0725e5c48ce54b8eb3be95bffad9 (diff) |
make ghc-8.0 happy
Diffstat (limited to 'packages/base/src/Internal')
-rw-r--r-- | packages/base/src/Internal/Matrix.hs | 3 | ||||
-rw-r--r-- | packages/base/src/Internal/Modular.hs | 16 | ||||
-rw-r--r-- | packages/base/src/Internal/Static.hs | 18 |
3 files changed, 18 insertions, 19 deletions
diff --git a/packages/base/src/Internal/Matrix.hs b/packages/base/src/Internal/Matrix.hs index 3082e8d..6efbe5f 100644 --- a/packages/base/src/Internal/Matrix.hs +++ b/packages/base/src/Internal/Matrix.hs | |||
@@ -5,8 +5,7 @@ | |||
5 | {-# LANGUAGE TypeOperators #-} | 5 | {-# LANGUAGE TypeOperators #-} |
6 | {-# LANGUAGE TypeFamilies #-} | 6 | {-# LANGUAGE TypeFamilies #-} |
7 | {-# LANGUAGE ViewPatterns #-} | 7 | {-# LANGUAGE ViewPatterns #-} |
8 | 8 | {-# LANGUAGE ConstrainedClassMethods #-} | |
9 | |||
10 | 9 | ||
11 | -- | | 10 | -- | |
12 | -- Module : Internal.Matrix | 11 | -- Module : Internal.Matrix |
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 | ||
75 | instance (Real t, KnownNat m, Integral (Mod m t)) => Real (Mod m t) | 75 | instance (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 | ||
117 | instance forall n t . (Integral t, KnownNat n) => Num (Mod n t) | 117 | instance (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 | ||
162 | instance forall m . KnownNat m => CTrans (Mod m I) | 162 | instance KnownNat m => CTrans (Mod m I) |
163 | instance forall m . KnownNat m => CTrans (Mod m Z) | 163 | instance KnownNat m => CTrans (Mod m Z) |
164 | 164 | ||
165 | 165 | ||
166 | instance forall m . KnownNat m => Container Vector (Mod m I) | 166 | instance 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 | ||
206 | instance forall m . KnownNat m => Container Vector (Mod m Z) | 206 | instance 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 | ||
312 | lift2m f a b = liftMatrix vmod (f (f2iM a) (f2iM b)) | 312 | lift2m f a b = liftMatrix vmod (f (f2iM a) (f2iM b)) |
313 | 313 | ||
314 | instance forall m . KnownNat m => Num (Vector (Mod m I)) | 314 | instance 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 | ||
324 | instance forall m . KnownNat m => Num (Vector (Mod m Z)) | 324 | instance KnownNat m => Num (Vector (Mod m Z)) |
325 | where | 325 | where |
326 | (+) = lift2 (+) | 326 | (+) = lift2 (+) |
327 | (*) = lift2 (*) | 327 | (*) = lift2 (*) |
diff --git a/packages/base/src/Internal/Static.hs b/packages/base/src/Internal/Static.hs index 61be456..2c31097 100644 --- a/packages/base/src/Internal/Static.hs +++ b/packages/base/src/Internal/Static.hs | |||
@@ -191,7 +191,7 @@ singleV v = LA.size v == 1 | |||
191 | singleM m = rows m == 1 && cols m == 1 | 191 | singleM m = rows m == 1 && cols m == 1 |
192 | 192 | ||
193 | 193 | ||
194 | instance forall n. KnownNat n => Sized ℂ (C n) Vector | 194 | instance KnownNat n => Sized ℂ (C n) Vector |
195 | where | 195 | where |
196 | size _ = fromIntegral . natVal $ (undefined :: Proxy n) | 196 | size _ = fromIntegral . natVal $ (undefined :: Proxy n) |
197 | konst x = mkC (LA.scalar x) | 197 | konst x = mkC (LA.scalar x) |
@@ -207,7 +207,7 @@ instance forall n. KnownNat n => Sized ℂ (C n) Vector | |||
207 | r = mkC v :: C n | 207 | r = mkC v :: C n |
208 | 208 | ||
209 | 209 | ||
210 | instance forall n. KnownNat n => Sized ℝ (R n) Vector | 210 | instance KnownNat n => Sized ℝ (R n) Vector |
211 | where | 211 | where |
212 | size _ = fromIntegral . natVal $ (undefined :: Proxy n) | 212 | size _ = fromIntegral . natVal $ (undefined :: Proxy n) |
213 | konst x = mkR (LA.scalar x) | 213 | konst x = mkR (LA.scalar x) |
@@ -224,7 +224,7 @@ instance forall n. KnownNat n => Sized ℝ (R n) Vector | |||
224 | 224 | ||
225 | 225 | ||
226 | 226 | ||
227 | instance forall m n . (KnownNat m, KnownNat n) => Sized ℝ (L m n) Matrix | 227 | instance (KnownNat m, KnownNat n) => Sized ℝ (L m n) Matrix |
228 | where | 228 | where |
229 | size _ = ((fromIntegral . natVal) (undefined :: Proxy m) | 229 | size _ = ((fromIntegral . natVal) (undefined :: Proxy m) |
230 | ,(fromIntegral . natVal) (undefined :: Proxy n)) | 230 | ,(fromIntegral . natVal) (undefined :: Proxy n)) |
@@ -242,7 +242,7 @@ instance forall m n . (KnownNat m, KnownNat n) => Sized ℝ (L m n) Matrix | |||
242 | r = mkL x :: L m n | 242 | r = mkL x :: L m n |
243 | 243 | ||
244 | 244 | ||
245 | instance forall m n . (KnownNat m, KnownNat n) => Sized ℂ (M m n) Matrix | 245 | instance (KnownNat m, KnownNat n) => Sized ℂ (M m n) Matrix |
246 | where | 246 | where |
247 | size _ = ((fromIntegral . natVal) (undefined :: Proxy m) | 247 | size _ = ((fromIntegral . natVal) (undefined :: Proxy m) |
248 | ,(fromIntegral . natVal) (undefined :: Proxy n)) | 248 | ,(fromIntegral . natVal) (undefined :: Proxy n)) |
@@ -300,7 +300,7 @@ isDiagg (Dim (Dim x)) | |||
300 | 300 | ||
301 | -------------------------------------------------------------------------------- | 301 | -------------------------------------------------------------------------------- |
302 | 302 | ||
303 | instance forall n . KnownNat n => Show (R n) | 303 | instance KnownNat n => Show (R n) |
304 | where | 304 | where |
305 | show s@(R (Dim v)) | 305 | show s@(R (Dim v)) |
306 | | singleV v = "("++show (v!0)++" :: R "++show d++")" | 306 | | singleV v = "("++show (v!0)++" :: R "++show d++")" |
@@ -308,7 +308,7 @@ instance forall n . KnownNat n => Show (R n) | |||
308 | where | 308 | where |
309 | d = size s | 309 | d = size s |
310 | 310 | ||
311 | instance forall n . KnownNat n => Show (C n) | 311 | instance KnownNat n => Show (C n) |
312 | where | 312 | where |
313 | show s@(C (Dim v)) | 313 | show s@(C (Dim v)) |
314 | | singleV v = "("++show (v!0)++" :: C "++show d++")" | 314 | | singleV v = "("++show (v!0)++" :: C "++show d++")" |
@@ -316,7 +316,7 @@ instance forall n . KnownNat n => Show (C n) | |||
316 | where | 316 | where |
317 | d = size s | 317 | d = size s |
318 | 318 | ||
319 | instance forall m n . (KnownNat m, KnownNat n) => Show (L m n) | 319 | instance (KnownNat m, KnownNat n) => Show (L m n) |
320 | where | 320 | where |
321 | show (isDiag -> Just (z,y,(m',n'))) = printf "(diag %s %s :: L %d %d)" (show z) (drop 9 $ show y) m' n' | 321 | show (isDiag -> Just (z,y,(m',n'))) = printf "(diag %s %s :: L %d %d)" (show z) (drop 9 $ show y) m' n' |
322 | show s@(L (Dim (Dim x))) | 322 | show s@(L (Dim (Dim x))) |
@@ -325,7 +325,7 @@ instance forall m n . (KnownNat m, KnownNat n) => Show (L m n) | |||
325 | where | 325 | where |
326 | (m',n') = size s | 326 | (m',n') = size s |
327 | 327 | ||
328 | instance forall m n . (KnownNat m, KnownNat n) => Show (M m n) | 328 | instance (KnownNat m, KnownNat n) => Show (M m n) |
329 | where | 329 | where |
330 | show (isDiagC -> Just (z,y,(m',n'))) = printf "(diag %s %s :: M %d %d)" (show z) (drop 9 $ show y) m' n' | 330 | show (isDiagC -> Just (z,y,(m',n'))) = printf "(diag %s %s :: M %d %d)" (show z) (drop 9 $ show y) m' n' |
331 | show s@(M (Dim (Dim x))) | 331 | show s@(M (Dim (Dim x))) |
@@ -336,7 +336,7 @@ instance forall m n . (KnownNat m, KnownNat n) => Show (M m n) | |||
336 | 336 | ||
337 | -------------------------------------------------------------------------------- | 337 | -------------------------------------------------------------------------------- |
338 | 338 | ||
339 | instance forall n t . (Num (Vector t), Numeric t )=> Num (Dim n (Vector t)) | 339 | instance (Num (Vector t), Numeric t )=> Num (Dim n (Vector t)) |
340 | where | 340 | where |
341 | (+) = lift2F (+) | 341 | (+) = lift2F (+) |
342 | (*) = lift2F (*) | 342 | (*) = lift2F (*) |