@@ -1,3 +1,4 @@
1+{-# LANGUAGE ConstraintKinds #-}
1{-# LANGUAGE AllowAmbiguousTypes #-}
2{-# LANGUAGE AllowAmbiguousTypes #-}
2{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DerivingVia #-}
4{-# LANGUAGE DerivingVia #-}
@@ -170,6 +171,17 @@ import qualified LAoP.Matrix.Internal as I
170newtype Matrix e (cols :: Type) (rows :: Type) = M (I.Matrix e (I.Normalize cols) (I.Normalize rows))
171newtype Matrix e (cols :: Type) (rows :: Type) = M (I.Matrix e (I.Normalize cols) (I.Normalize rows))
171 deriving (Show, Num, Eq, Ord, NFData) via (I.Matrix e (I.Normalize cols) (I.Normalize rows))
172 deriving (Show, Num, Eq, Ord, NFData) via (I.Matrix e (I.Normalize cols) (I.Normalize rows))
174+-- | Constraint type synonyms to keep the type signatures less convoluted
175+type Countable a = KnownNat (I.Count a)
176+type CountableDimensions a b = (Countable a, Countable b)
177+type CountableN a = KnownNat (I.Count (I.Normalize a))
178+type CountableDimensionsN a b = (CountableN a, CountableN b)
179+type FromListsN e a b = I.FromLists e (I.Normalize a) (I.Normalize b)
180+type Liftable e a b = (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num e, Ord e)
181+type Trivial a = I.Normalize a ~ I.Normalize (I.Normalize a)
182+type TrivialE a b = I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)
183+type TrivialP a b = I.Normalize (a, b) ~ I.Normalize (I.Normalize a, I.Normalize b)
173-- | It isn't possible to implement the 'id' function so it's
185-- | It isn't possible to implement the 'id' function so it's
174-- implementation is 'undefined'. However 'comp' can be and this partial
186-- implementation is 'undefined'. However 'comp' can be and this partial
175-- class implementation exists just to make the code more readable.
187-- class implementation exists just to make the code more readable.
@@ -197,7 +209,7 @@ one = M . I.One
198-- | Matrix 'Junc' constructor
210-- | Matrix 'Junc' constructor
200− (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
212+ (TrivialE a b) =>
201 Matrix e a rows ->
213 Matrix e a rows ->
202 Matrix e b rows ->
214 Matrix e b rows ->
203 Matrix e (Either a b) rows
215 Matrix e (Either a b) rows
@@ -206,7 +218,7 @@ junc (M a) (M b) = M (I.Junc a b)
206infixl 3 |||
218infixl 3 |||
207-- | Matrix 'Junc' constructor
219-- | Matrix 'Junc' constructor
209− (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
221+ (TrivialE a b) =>
210 Matrix e a rows ->
222 Matrix e a rows ->
211 Matrix e b rows ->
223 Matrix e b rows ->
212 Matrix e (Either a b) rows
224 Matrix e (Either a b) rows
@@ -214,7 +226,7 @@ infixl 3 |||
215-- | Matrix 'Split' constructor
227-- | Matrix 'Split' constructor
217− (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
229+ (TrivialE a b) =>
218 Matrix e cols a ->
230 Matrix e cols a ->
219 Matrix e cols b ->
231 Matrix e cols b ->
220 Matrix e cols (Either a b)
232 Matrix e cols (Either a b)
@@ -223,7 +235,7 @@ split (M a) (M b) = M (I.Split a b)
223infixl 2 ===
235infixl 2 ===
224-- | Matrix 'Split' constructor
236-- | Matrix 'Split' constructor
226− (I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)) =>
238+ (TrivialE a b) =>
227 Matrix e cols a ->
239 Matrix e cols a ->
228 Matrix e cols b ->
240 Matrix e cols b ->
229 Matrix e cols (Either a b)
241 Matrix e cols (Either a b)
@@ -233,16 +245,9 @@ infixl 2 ===
234-- | Functor instance equivalent function
246-- | Functor instance equivalent function
236− ( Bounded a,
248+ ( Liftable e a b,
237− Bounded b,
249+ CountableDimensionsN a b,
238− Enum a,
250+ FromListsN e b a
243− KnownNat (I.Count (I.Normalize a)),
244− KnownNat (I.Count (I.Normalize b)),
245− I.FromLists e (I.Normalize b) (I.Normalize a)
248 (a -> b) -> Matrix e c a -> Matrix e c b
253 (a -> b) -> Matrix e c a -> Matrix e c b
@@ -254,25 +259,23 @@ unitM = one 1
255-- | Applicative instance equivalent 'unit' function,
260-- | Applicative instance equivalent 'unit' function,
257− ( KnownNat (I.Count (I.Normalize a)),
262+ ( CountableDimensionsN a b,
258− KnownNat (I.Count (I.Normalize b)),
263+ CountableN (a, b),
259− KnownNat (I.Count (I.Normalize (a, b))),
261− I.FromLists e (I.Normalize (a, b)) (I.Normalize a),
265+ FromListsN e (a, b) a,
262− I.FromLists e (I.Normalize (a, b)) (I.Normalize b),
266+ FromListsN e (a, b) b,
263− I.Normalize (a, b) ~ I.Normalize (I.Normalize a, I.Normalize b)
267+ TrivialP a b
264 ) => Matrix e c a -> Matrix e c b -> Matrix e c (a, b)
268 ) => Matrix e c a -> Matrix e c b -> Matrix e c (a, b)
265−multM a b = khatri a b
269+multM = khatri
268-- | Monad instance equivalent 'return' function,
271-- | Monad instance equivalent 'return' function,
269returnM ::
272returnM ::
270 forall e a .
273 forall e a .
271− ( Num e,
274+ ( Num e,
272− Enum e,
275+ Enum e,
273− Enum a,
276+ Enum a,
274− I.FromLists e () (I.Normalize a),
277+ FromListsN e () a,
275− KnownNat (I.Count a)
278+ Countable a
276 ) => a -> Matrix e One a
279 ) => a -> Matrix e One a
277returnM a = col l
280returnM a = col l
@@ -288,23 +291,22 @@ bindM = flip comp
289-- | Build a matrix out of a list of list of elements. Throws a runtime
292-- | Build a matrix out of a list of list of elements. Throws a runtime
290-- error if the dimensions do not match.
293-- error if the dimensions do not match.
291−fromLists :: (I.FromLists e (I.Normalize cols) (I.Normalize rows)) => [[e]] -> Matrix e cols rows
294+fromLists :: (FromListsN e cols rows) => [[e]] -> Matrix e cols rows
292fromLists = M . I.fromLists
295fromLists = M . I.fromLists
294-- | Matrix builder function. Constructs a matrix provided with
297-- | Matrix builder function. Constructs a matrix provided with
295-- a construction function.
298-- a construction function.
296matrixBuilder ::
299matrixBuilder ::
297− (I.FromLists e (I.Normalize cols) (I.Normalize rows), KnownNat (I.Count (I.Normalize cols)), KnownNat (I.Count (I.Normalize rows))) =>
300+ (FromListsN e cols rows, CountableDimensionsN cols rows )
298− ((Int, Int) -> e) ->
299− Matrix e cols rows
301+ => ((Int, Int) -> e) -> Matrix e cols rows
300matrixBuilder = M . I.matrixBuilder
302matrixBuilder = M . I.matrixBuilder
302-- | Constructs a column vector matrix
304-- | Constructs a column vector matrix
303−col :: (I.FromLists e () (I.Normalize rows)) => [e] -> Matrix e One rows
305+col :: (FromListsN e () rows) => [e] -> Matrix e One rows
304col = M . I.col
306col = M . I.col
306-- | Constructs a row vector matrix
308-- | Constructs a row vector matrix
307−row :: (I.FromLists e (I.Normalize cols) ()) => [e] -> Matrix e cols One
309+row :: (FromListsN e cols ()) => [e] -> Matrix e cols One
308row = M . I.row
310row = M . I.row
310-- | Lifts functions to matrices with arbitrary dimensions.
312-- | Lifts functions to matrices with arbitrary dimensions.
@@ -312,49 +314,28 @@ row = M . I.row
312-- NOTE: Be careful to not ask for a matrix bigger than the cardinality of
314-- NOTE: Be careful to not ask for a matrix bigger than the cardinality of
313-- types @a@ or @b@ allows.
315-- types @a@ or @b@ allows.
315− ( Bounded a,
317+ ( Liftable e a b,
316− Bounded b,
318+ CountableDimensionsN cols rows,
317− Enum a,
319+ FromListsN e rows cols
322− KnownNat (I.Count (I.Normalize cols)),
323− KnownNat (I.Count (I.Normalize rows)),
324− I.FromLists e (I.Normalize rows) (I.Normalize cols)
327− Matrix e cols rows
321+ (a -> b) -> Matrix e cols rows
328fromF = M . I.fromF
322fromF = M . I.fromF
330-- | Lifts functions to matrices with dimensions matching @a@ and @b@
324-- | Lifts functions to matrices with dimensions matching @a@ and @b@
331-- cardinality's.
325-- cardinality's.
333− ( Bounded a,
327+ ( Liftable e a b,
334− Bounded b,
328+ CountableDimensionsN a b,
335− Enum a,
329+ FromListsN e b a
340− KnownNat (I.Count (I.Normalize a)),
341− KnownNat (I.Count (I.Normalize b)),
342− I.FromLists e (I.Normalize b) (I.Normalize a)
345− Matrix e a b
331+ (a -> b) -> Matrix e a b
346fromF' = M . I.fromF'
332fromF' = M . I.fromF'
348-- | Lifts relation functions to Boolean Matrix
334-- | Lifts relation functions to Boolean Matrix
350− ( Bounded a,
336+ ( Liftable (Natural 0 1) a b,
351− Bounded b,
337+ CountableDimensionsN a b,
352− Enum a,
338+ FromListsN (Natural 0 1) b a
355− KnownNat (I.Count (I.Normalize a)),
356− KnownNat (I.Count (I.Normalize b)),
357− I.FromLists (Natural 0 1) (I.Normalize b) (I.Normalize a)
358 ) => (a -> b -> Bool) -> Matrix (Natural 0 1) a b
339 ) => (a -> b -> Bool) -> Matrix (Natural 0 1) a b
359toRel = M . I.toRel
340toRel = M . I.toRel
@@ -372,8 +353,8 @@ toList (M m) = I.toList m
373-- | The zero matrix. A matrix wholly filled with zeros.
354-- | The zero matrix. A matrix wholly filled with zeros.
375− (Num e, I.FromLists e (I.Normalize cols) (I.Normalize rows), KnownNat (I.Count (I.Normalize cols)), KnownNat (I.Count (I.Normalize rows))) =>
356+ (Num e, FromListsN e cols rows, CountableDimensionsN cols rows)
376− Matrix e cols rows
357+ => Matrix e cols rows
377zeros = M I.zeros
358zeros = M I.zeros
379-- Ones Matrix
360-- Ones Matrix
@@ -382,8 +363,8 @@ zeros = M I.zeros
383-- Also known as T (Top) matrix.
364-- Also known as T (Top) matrix.
385− (Num e, I.FromLists e (I.Normalize cols) (I.Normalize rows), KnownNat (I.Count (I.Normalize cols)), KnownNat (I.Count (I.Normalize rows))) =>
366+ (Num e, FromListsN e cols rows, CountableDimensionsN cols rows)
386− Matrix e cols rows
367+ => Matrix e cols rows
387ones = M I.ones
368ones = M I.ones
389-- Const Matrix
370-- Const Matrix
@@ -391,9 +372,8 @@ ones = M I.ones
391-- | The constant matrix constructor. A matrix wholly filled with a given
372-- | The constant matrix constructor. A matrix wholly filled with a given
393constant ::
374constant ::
394− (Num e, I.FromLists e (I.Normalize cols) (I.Normalize rows), KnownNat (I.Count (I.Normalize cols)), KnownNat (I.Count (I.Normalize rows))) =>
375+ (Num e, FromListsN e cols rows, CountableDimensionsN cols rows)
396− Matrix e cols rows
376+ => e -> Matrix e cols rows
397constant = M . I.constant
377constant = M . I.constant
399-- Bang Matrix
379-- Bang Matrix
@@ -401,7 +381,7 @@ constant = M . I.constant
401-- | The T (Top) row vector matrix.
381-- | The T (Top) row vector matrix.
403 forall e cols.
383 forall e cols.
404− (Num e, Enum e, I.FromLists e (I.Normalize cols) (), KnownNat (I.Count (I.Normalize cols))) =>
384+ (Num e, Enum e, FromListsN e cols (), CountableN cols) =>
405 Matrix e cols One
385 Matrix e cols One
406bang = M I.bang
386bang = M I.bang
@@ -409,7 +389,7 @@ bang = M I.bang
410-- | Identity matrix
390-- | Identity matrix
411identity ::
391identity ::
412− (Num e, I.FromLists e (I.Normalize a) (I.Normalize a), KnownNat (I.Count (I.Normalize a))) =>
392+ (Num e, FromListsN e a a, CountableN a) =>
413 Matrix e a a
393 Matrix e a a
414identity = M I.identity
394identity = M I.identity
@@ -425,11 +405,10 @@ comp (M a) (M b) = M (I.comp a b)
425-- | Biproduct first component projection
405-- | Biproduct first component projection
428− KnownNat (I.Count (I.Normalize n)),
408+ CountableDimensionsN n m,
429− KnownNat (I.Count (I.Normalize m)),
409+ FromListsN e n m,
430− I.FromLists e (I.Normalize n) (I.Normalize m),
410+ FromListsN e m m,
431− I.FromLists e (I.Normalize m) (I.Normalize m),
411+ TrivialE m n
432− I.Normalize (Either m n) ~ Either (I.Normalize m) (I.Normalize n)
434 Matrix e (Either m n) m
413 Matrix e (Either m n) m
435p1 = M I.p1
414p1 = M I.p1
@@ -437,11 +416,10 @@ p1 = M I.p1
437-- | Biproduct second component projection
416-- | Biproduct second component projection
440− KnownNat (I.Count (I.Normalize n)),
419+ CountableDimensionsN n m,
441− KnownNat (I.Count (I.Normalize m)),
420+ FromListsN e m n,
442− I.FromLists e (I.Normalize m) (I.Normalize n),
421+ FromListsN e n n,
443− I.FromLists e (I.Normalize n) (I.Normalize n),
422+ TrivialE m n
444− I.Normalize (Either m n) ~ Either (I.Normalize m) (I.Normalize n)
446 Matrix e (Either m n) n
424 Matrix e (Either m n) n
447p2 = M I.p2
425p2 = M I.p2
@@ -451,11 +429,10 @@ p2 = M I.p2
451-- | Biproduct first component injection
429-- | Biproduct first component injection
454− KnownNat (I.Count (I.Normalize n)),
432+ CountableDimensionsN n m,
455− KnownNat (I.Count (I.Normalize m)),
433+ FromListsN e n m,
456− I.FromLists e (I.Normalize n) (I.Normalize m),
434+ FromListsN e m m,
457− I.FromLists e (I.Normalize m) (I.Normalize m),
435+ TrivialE m n
458− I.Normalize (Either m n) ~ Either (I.Normalize m) (I.Normalize n)
460 Matrix e m (Either m n)
437 Matrix e m (Either m n)
461i1 = tr p1
438i1 = tr p1
@@ -463,11 +440,10 @@ i1 = tr p1
463-- | Biproduct second component injection
440-- | Biproduct second component injection
466− KnownNat (I.Count (I.Normalize n)),
443+ CountableDimensionsN n m,
467− KnownNat (I.Count (I.Normalize m)),
444+ FromListsN e m n,
468− I.FromLists e (I.Normalize m) (I.Normalize n),
445+ FromListsN e n n,
469− I.FromLists e (I.Normalize n) (I.Normalize n),
446+ TrivialE m n
470− I.Normalize (Either m n) ~ Either (I.Normalize m) (I.Normalize n)
472 Matrix e n (Either m n)
448 Matrix e n (Either m n)
473i2 = tr p2
449i2 = tr p2
@@ -481,7 +457,7 @@ i2 = tr p2
482-- TODO: A 'rows' function that does not need the 'KnownNat' constraint in
458-- TODO: A 'rows' function that does not need the 'KnownNat' constraint in
483-- exchange for performance.
459-- exchange for performance.
484−rows :: (KnownNat (I.Count (I.Normalize rows))) => Matrix e cols rows -> Int
460+rows :: (CountableN rows) => Matrix e cols rows -> Int
485rows (M m) = I.rows m
461rows (M m) = I.rows m
487-- | Obtain the number of columns.
463-- | Obtain the number of columns.
@@ -491,7 +467,7 @@ rows (M m) = I.rows m
492-- TODO: A 'columns' function that does not need the 'KnownNat' constraint in
468-- TODO: A 'columns' function that does not need the 'KnownNat' constraint in
493-- exchange for performance.
469-- exchange for performance.
494−columns :: (KnownNat (I.Count (I.Normalize cols))) => Matrix e cols rows -> Int
470+columns :: (CountableN cols) => Matrix e cols rows -> Int
495columns (M m) = I.columns m
471columns (M m) = I.columns m
497-- Coproduct Bifunctor
473-- Coproduct Bifunctor
@@ -501,14 +477,13 @@ infixl 5 -|-
501-- | Matrix coproduct functor also known as matrix direct sum.
477-- | Matrix coproduct functor also known as matrix direct sum.
504− KnownNat (I.Count (I.Normalize j)),
480+ CountableDimensionsN j k,
505− KnownNat (I.Count (I.Normalize k)),
481+ FromListsN e k k,
506− I.FromLists e (I.Normalize k) (I.Normalize k),
482+ FromListsN e j k,
507− I.FromLists e (I.Normalize j) (I.Normalize k),
483+ FromListsN e k j,
508− I.FromLists e (I.Normalize k) (I.Normalize j),
484+ FromListsN e j j,
509− I.FromLists e (I.Normalize j) (I.Normalize j),
485+ TrivialE n m,
510− I.Normalize (Either n m) ~ Either (I.Normalize n) (I.Normalize m),
486+ TrivialE k j
511− I.Normalize (Either k j) ~ Either (I.Normalize k) (I.Normalize j)
513 Matrix e n k ->
488 Matrix e n k ->
514 Matrix e m j ->
489 Matrix e m j ->
@@ -521,11 +496,10 @@ infixl 5 -|-
522 forall e m k .
497 forall e m k .
524− KnownNat (I.Count (I.Normalize m)),
499+ CountableDimensionsN m k,
525− KnownNat (I.Count (I.Normalize k)),
500+ CountableN (m, k),
526− KnownNat (I.Count (I.Normalize (m, k))),
501+ FromListsN e (m, k) m,
527− I.FromLists e (I.Normalize (m, k)) (I.Normalize m),
502+ TrivialP m k
528− I.Normalize (m, k) ~ I.Normalize (I.Normalize m, I.Normalize k)
529 ) => Matrix e (m, k) m
503 ) => Matrix e (m, k) m
530kp1 = M (I.kp1 @e @(I.Normalize m) @(I.Normalize k))
504kp1 = M (I.kp1 @e @(I.Normalize m) @(I.Normalize k))
@@ -533,11 +507,10 @@ kp1 = M (I.kp1 @e @(I.Normalize m) @(I.Normalize k))
534 forall e m k.
508 forall e m k.
536− KnownNat (I.Count (I.Normalize k)),
510+ CountableDimensionsN k m,
537− KnownNat (I.Count (I.Normalize m)),
511+ CountableN (m, k),
538− KnownNat (I.Count (I.Normalize (m, k))),
512+ FromListsN e (m, k) k,
539− I.FromLists e (I.Normalize (m, k)) (I.Normalize k),
513+ TrivialP m k
540− I.Normalize (m, k) ~ I.Normalize (I.Normalize m, I.Normalize k)
541 ) => Matrix e (m, k) k
514 ) => Matrix e (m, k) k
542kp2 = M (I.kp2 @e @(I.Normalize m) @(I.Normalize k))
515kp2 = M (I.kp2 @e @(I.Normalize m) @(I.Normalize k))
@@ -555,12 +528,11 @@ kp2 = M (I.kp2 @e @(I.Normalize m) @(I.Normalize k))
556 forall e cols a b.
529 forall e cols a b.
558− KnownNat (I.Count (I.Normalize a)),
531+ CountableDimensionsN a b,
559− KnownNat (I.Count (I.Normalize b)),
532+ CountableN (a, b),
560− KnownNat (I.Count (I.Normalize (a, b))),
533+ FromListsN e (a, b) a,
561− I.FromLists e (I.Normalize (a, b)) (I.Normalize a),
534+ FromListsN e (a, b) b,
562− I.FromLists e (I.Normalize (a, b)) (I.Normalize b),
535+ TrivialP a b
563− I.Normalize (a, b) ~ I.Normalize (I.Normalize a, I.Normalize b)
564 ) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (a, b)
536 ) => Matrix e cols a -> Matrix e cols b -> Matrix e cols (a, b)
565khatri a b =
537khatri a b =
566 let kp1' = kp1 @e @a @b
538 let kp1' = kp1 @e @a @b
@@ -575,18 +547,15 @@ infixl 4 ><
576 forall e m p n q.
548 forall e m p n q.
578− KnownNat (I.Count (I.Normalize m)),
550+ CountableDimensionsN m n,
579− KnownNat (I.Count (I.Normalize n)),
551+ CountableDimensionsN p q,
580− KnownNat (I.Count (I.Normalize p)),
552+ CountableDimensionsN (m, n) (p, q),
581− KnownNat (I.Count (I.Normalize q)),
553+ FromListsN e (m, n) m,
582− KnownNat (I.Count (I.Normalize (m, n))),
554+ FromListsN e (m, n) n,
583− KnownNat (I.Count (I.Normalize (p, q))),
555+ FromListsN e (p, q) p,
584− I.FromLists e (I.Normalize (m, n)) (I.Normalize m),
556+ FromListsN e (p, q) q,
585− I.FromLists e (I.Normalize (m, n)) (I.Normalize n),
557+ TrivialP m n,
586− I.FromLists e (I.Normalize (p, q)) (I.Normalize p),
558+ TrivialP p q
587− I.FromLists e (I.Normalize (p, q)) (I.Normalize q),
588− I.Normalize (m, n) ~ I.Normalize (I.Normalize m, I.Normalize n),
589− I.Normalize (p, q) ~ I.Normalize (I.Normalize p, I.Normalize q)
590 ) => Matrix e m p -> Matrix e n q -> Matrix e (m, n) (p, q)
559 ) => Matrix e m p -> Matrix e n q -> Matrix e (m, n) (p, q)
591(><) a b =
560(><) a b =
592 let kp1' = kp1 @e @m @n
561 let kp1' = kp1 @e @m @n
@@ -629,9 +598,9 @@ tr (M m) = M (I.tr m)
629-- ArrowMonad solution presented in the paper.
598-- ArrowMonad solution presented in the paper.
630selectM ::
599selectM ::
632− I.FromLists e (I.Normalize b) (I.Normalize b),
601+ FromListsN e b b,
633− KnownNat (I.Count (I.Normalize b)),
602+ CountableN b,
634− I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)
603+ TrivialE a b
635 ) => Matrix e cols (Either a b) -> Matrix e a b -> Matrix e cols b
604 ) => Matrix e cols (Either a b) -> Matrix e a b -> Matrix e cols b
636selectM (M m) (M y) = M (I.select m y)
605selectM (M m) (M y) = M (I.select m y)
@@ -639,15 +608,12 @@ selectM (M m) (M y) = M (I.select m y)
640-- | McCarthy's Conditional expresses probabilistic choice.
609-- | McCarthy's Conditional expresses probabilistic choice.
642− ( I.Normalize (I.Normalize a) ~ I.Normalize a,
611+ ( Trivial a,
643− KnownNat (I.Count (I.Normalize a)),
612+ CountableN a,
644− I.FromLists e () (I.Normalize a),
613+ FromListsN e () a,
645− I.FromLists e (I.Normalize a) (),
614+ FromListsN e a (),
646− I.FromLists e (I.Normalize a) (I.Normalize a),
615+ FromListsN e a a,
647− Bounded a,
616+ Liftable e a Bool
653 (a -> Bool) -> Matrix e a b -> Matrix e a b -> Matrix e a b
619 (a -> Bool) -> Matrix e a b -> Matrix e a b -> Matrix e a b
@@ -656,9 +622,9 @@ cond p (M a) (M b) = M (I.cond p a b)
656-- Pretty print
622-- Pretty print
658-- | Matrix pretty printer
624-- | Matrix pretty printer
659−pretty :: (KnownNat (I.Count (I.Normalize cols)), Show e) => Matrix e cols rows -> String
625+pretty :: (CountableN cols, Show e) => Matrix e cols rows -> String
660pretty (M m) = I.pretty m
626pretty (M m) = I.pretty m
662-- | Matrix pretty printer
628-- | Matrix pretty printer
663−prettyPrint :: (KnownNat (I.Count (I.Normalize cols)), Show e) => Matrix e cols rows -> IO ()
629+prettyPrint :: (CountableN cols, Show e) => Matrix e cols rows -> IO ()
664prettyPrint (M m) = I.prettyPrint m
630prettyPrint (M m) = I.prettyPrint m