on master help sign in
Small fixes
bf2cb96Armando Santos
src/Matrix/Internal.hs+9−9
@@ -209,8 +209,8 @@ instance Eq e => Eq (Matrix e cols rows) where
209 (One a) == (One b) = a == b
209 (One a) == (One b) = a == b
210 (Junc a b) == (Junc c d) = a == c && b == d
210 (Junc a b) == (Junc c d) = a == c && b == d
211 (Split a b) == (Split c d) = a == c && b == d
211 (Split a b) == (Split c d) = a == c && b == d
212− x@(Split a b) == y@(Junc c d) = x == abideJS y
212+ x@(Split _ _) == y@(Junc _ _) = x == abideJS y
213− x@(Junc a b) == y@(Split c d) = abideJS x == y
213+ x@(Junc _ _) == y@(Split _ _) = abideJS x == y
214
214
215instance Num e => Num (Matrix e cols rows) where
215instance Num e => Num (Matrix e cols rows) where
216
216
@@ -218,22 +218,22 @@ instance Num e => Num (Matrix e cols rows) where
218 (One a) + (One b) = One (a + b)
218 (One a) + (One b) = One (a + b)
219 (Junc a b) + (Junc c d) = Junc (a + c) (b + d)
219 (Junc a b) + (Junc c d) = Junc (a + c) (b + d)
220 (Split a b) + (Split c d) = Split (a + c) (b + d)
220 (Split a b) + (Split c d) = Split (a + c) (b + d)
221− x@(Split a b) + y@(Junc c d) = x + abideJS y
221+ x@(Split _ _) + y@(Junc _ _) = x + abideJS y
222− x@(Junc a b) + y@(Split c d) = abideJS x + y
222+ x@(Junc _ _) + y@(Split _ _) = abideJS x + y
223
223
224 Empty - Empty = Empty
224 Empty - Empty = Empty
225 (One a) - (One b) = One (a - b)
225 (One a) - (One b) = One (a - b)
226 (Junc a b) - (Junc c d) = Junc (a - c) (b - d)
226 (Junc a b) - (Junc c d) = Junc (a - c) (b - d)
227 (Split a b) - (Split c d) = Split (a - c) (b - d)
227 (Split a b) - (Split c d) = Split (a - c) (b - d)
228− x@(Split a b) - y@(Junc c d) = x - abideJS y
228+ x@(Split _ _) - y@(Junc _ _) = x - abideJS y
229− x@(Junc a b) - y@(Split c d) = abideJS x - y
229+ x@(Junc _ _) - y@(Split _ _) = abideJS x - y
230
230
231 Empty * Empty = Empty
231 Empty * Empty = Empty
232 (One a) * (One b) = One (a * b)
232 (One a) * (One b) = One (a * b)
233 (Junc a b) * (Junc c d) = Junc (a * c) (b * d)
233 (Junc a b) * (Junc c d) = Junc (a * c) (b * d)
234 (Split a b) * (Split c d) = Split (a * c) (b * d)
234 (Split a b) * (Split c d) = Split (a * c) (b * d)
235− x@(Split a b) * y@(Junc c d) = x * abideJS y
235+ x@(Split _ _) * y@(Junc _ _) = x * abideJS y
236− x@(Junc a b) * y@(Split c d) = abideJS x * y
236+ x@(Junc _ _) * y@(Split _ _) = abideJS x * y
237
237
238 abs Empty = Empty
238 abs Empty = Empty
239 abs (One a) = One (abs a)
239 abs (One a) = One (abs a)
@@ -309,7 +309,7 @@ instance {-# OVERLAPPING #-} (FromLists e () rows) => FromLists e () (Either ()
309 fromLists _ = error "Wrong dimensions"
309 fromLists _ = error "Wrong dimensions"
310
310
311instance {-# OVERLAPPABLE #-} (FromLists e () a, FromLists e () b, KnownNat (Count a)) => FromLists e () (Either a b) where
311instance {-# OVERLAPPABLE #-} (FromLists e () a, FromLists e () b, KnownNat (Count a)) => FromLists e () (Either a b) where
312− fromLists l@([h] : t) =
312+ fromLists l@([_] : _) =
313 let rowsA = fromInteger (natVal (Proxy :: Proxy (Count a)))
313 let rowsA = fromInteger (natVal (Proxy :: Proxy (Count a)))
314 in Split (fromLists (take rowsA l)) (fromLists (drop rowsA l))
314 in Split (fromLists (take rowsA l)) (fromLists (drop rowsA l))
315 fromLists _ = error "Wrong dimensions"
315 fromLists _ = error "Wrong dimensions"