packages feed

cybus 0.1.0.0 → 0.2.0.0

raw patch · 10 files changed

+1022/−933 lines, 10 filesdep ~posdep ~primusPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: pos, primus

API changes (from Hackage documentation)

- Cybus.FinMat: class NSC (ns :: NonEmpty Nat)
- Cybus.FinMat: instance (Data.Pos.NSC is, Data.Pos.NSC ns, Cybus.FinMat.FinMatT is ns 1 is ns) => Cybus.FinMat.FinMatC is ns
- Cybus.FinMat: instance (TypeError ...) => Cybus.FinMat.NSRangeC 'Cybus.NatHelper.Z (n 'GHC.Base.:| ns)
- Cybus.FinMat: instance (TypeError ...) => Cybus.FinMat.NSRangeC ('Cybus.NatHelper.S ('Cybus.NatHelper.S i)) (n 'GHC.Base.:| '[])
- Cybus.FinMat: instance Cybus.FinMat.NSRangeC ('Cybus.NatHelper.S 'Cybus.NatHelper.Z) (n 'GHC.Base.:| ns)
- Cybus.FinMat: instance Cybus.FinMat.NSRangeC ('Cybus.NatHelper.S i) (m 'GHC.Base.:| ns) => Cybus.FinMat.NSRangeC ('Cybus.NatHelper.S ('Cybus.NatHelper.S i)) (n 'GHC.Base.:| (m : ns))
- Cybus.FinMat: instance Data.Pos.NSC ns => GHC.Base.Monoid (Cybus.FinMat.FinMat ns)
- Cybus.FinMat: instance Data.Pos.NSC ns => GHC.Enum.Bounded (Cybus.FinMat.FinMat ns)
- Cybus.FinMat: instance Data.Pos.NSC ns => GHC.Enum.Enum (Cybus.FinMat.FinMat ns)
- Cybus.FinMat: instance Data.Pos.NSC ns => GHC.Num.Num (Cybus.FinMat.FinMat ns)
- Cybus.FinMat: instance Data.Pos.NSC ns => GHC.Read.Read (Cybus.FinMat.FinMat ns)
- Cybus.FinMat: instance Data.Pos.NSC ns => Primus.Num1.Num1 (Cybus.FinMat.FinMat ns)
- Cybus.Mat: instance (Cybus.Fin.FinT i n, Cybus.Mat.SliceC (i1 'GHC.Base.:| is) (n1 'GHC.Base.:| ns)) => Cybus.Mat.SliceC (i 'GHC.Base.:| (i1 : is)) (n 'GHC.Base.:| (n1 : ns))
- Cybus.Mat: instance (Cybus.Mat.ConsMatCTA (1 'GHC.Base.:| '[]) a GHC.Types.~ a, Cybus.Mat.ConsMatCTA (1 'GHC.Base.:| '[]) b GHC.Types.~ b, Cybus.Mat.ConsMatCTB (1 'GHC.Base.:| '[]) a GHC.Types.~ Cybus.Mat.Eof1, Cybus.Mat.ConsMatCTB (1 'GHC.Base.:| '[]) b GHC.Types.~ Cybus.Mat.Eof1) => Cybus.Mat.ConsMatC (1 'GHC.Base.:| '[]) a b
- Cybus.Mat: instance (Cybus.Mat.ConsMatCTA (1 'GHC.Base.:| (m : ns)) a GHC.Types.~ Cybus.Mat.Mat (m 'GHC.Base.:| ns) a, Cybus.Mat.ConsMatCTA (1 'GHC.Base.:| (m : ns)) b GHC.Types.~ Cybus.Mat.Mat (m 'GHC.Base.:| ns) b, Cybus.Mat.ConsMatCTB (1 'GHC.Base.:| (m : ns)) a GHC.Types.~ Cybus.Mat.EofN, Cybus.Mat.ConsMatCTB (1 'GHC.Base.:| (m : ns)) b GHC.Types.~ Cybus.Mat.EofN) => Cybus.Mat.ConsMatC (1 'GHC.Base.:| (n1 : ns)) a b
- Cybus.Mat: instance (Cybus.Mat.ConsMatCTA (n 'GHC.Base.:| '[]) a GHC.Types.~ a, Cybus.Mat.ConsMatCTA (n 'GHC.Base.:| '[]) b GHC.Types.~ b, Cybus.Mat.ConsMatCTB (n 'GHC.Base.:| '[]) a GHC.Types.~ Cybus.Mat.Vec (n GHC.TypeNats.- 1) a, Cybus.Mat.ConsMatCTB (n 'GHC.Base.:| '[]) b GHC.Types.~ Cybus.Mat.Vec (n GHC.TypeNats.- 1) b) => Cybus.Mat.ConsMatC (n 'GHC.Base.:| '[]) a b
- Cybus.Mat: instance (Cybus.Mat.ConsMatCTA (n 'GHC.Base.:| (m : ns)) a GHC.Types.~ Cybus.Mat.Mat (m 'GHC.Base.:| ns) a, Cybus.Mat.ConsMatCTA (n 'GHC.Base.:| (m : ns)) b GHC.Types.~ Cybus.Mat.Mat (m 'GHC.Base.:| ns) b, Cybus.Mat.ConsMatCTB (n 'GHC.Base.:| (m : ns)) a GHC.Types.~ Cybus.Mat.Mat ((n GHC.TypeNats.- 1) 'GHC.Base.:| (m : ns)) a, Cybus.Mat.ConsMatCTB (n 'GHC.Base.:| (m : ns)) b GHC.Types.~ Cybus.Mat.Mat ((n GHC.TypeNats.- 1) 'GHC.Base.:| (m : ns)) b) => Cybus.Mat.ConsMatC (n 'GHC.Base.:| (m : ns)) a b
- Cybus.Mat: instance (Cybus.Mat.ConsMatCTB (n 'GHC.Base.:| '[]) a GHC.Types.~ Cybus.Mat.Vec (n GHC.TypeNats.- 1) a, Cybus.Mat.ConsMatCTB (n 'GHC.Base.:| '[]) b GHC.Types.~ Cybus.Mat.Vec (n GHC.TypeNats.- 1) b) => Cybus.Mat.SnocMatC (n 'GHC.Base.:| '[]) a b
- Cybus.Mat: instance (Cybus.Mat.ConsMatCTB (n 'GHC.Base.:| (m : ns)) a GHC.Types.~ Cybus.Mat.Mat ((n GHC.TypeNats.- 1) 'GHC.Base.:| (m : ns)) a, Cybus.Mat.ConsMatCTB (n 'GHC.Base.:| (m : ns)) a GHC.Types.~ Cybus.Mat.Mat ((n GHC.TypeNats.- 1) 'GHC.Base.:| (m : ns)) b) => Cybus.Mat.SnocMatC (n 'GHC.Base.:| (m : ns)) a b
- Cybus.Mat: instance (Cybus.Mat.ListTupleCInternal n, Data.Pos.NSC (n1 'GHC.Base.:| ns), Cybus.Mat.MatTupleC (n1 'GHC.Base.:| ns) a) => Cybus.Mat.MatTupleC (n 'GHC.Base.:| (n1 : ns)) a
- Cybus.Mat: instance (Cybus.Mat.MatConvertersC ns, Data.Pos.NSC ns, GHC.Read.Read (Cybus.NatHelper.ListNST ns a)) => GHC.Read.Read (Cybus.Mat.Mat ns a)
- Cybus.Mat: instance (Data.Pos.NSC ns, GHC.Enum.Bounded a) => GHC.Enum.Bounded (Cybus.Mat.Mat ns a)
- Cybus.Mat: instance (Data.Pos.NSC ns, GHC.Num.Num a) => GHC.Num.Num (Cybus.Mat.Mat ns a)
- Cybus.Mat: instance (Data.Pos.NSC ns, GHC.Real.Fractional a) => GHC.Real.Fractional (Cybus.Mat.Mat ns a)
- Cybus.Mat: instance (Data.Pos.PosT n, Cybus.Mat.MatConvertersC (m 'GHC.Base.:| ns)) => Cybus.Mat.MatConvertersC (n 'GHC.Base.:| (m : ns))
- Cybus.Mat: instance (GHC.Base.Monoid a, Data.Pos.NSC ns) => GHC.Base.Monoid (Cybus.Mat.Mat ns a)
- Cybus.Mat: instance (GHC.Enum.Enum a, GHC.Enum.Bounded a, Data.Pos.NSC ns) => GHC.Enum.Enum (Cybus.Mat.Mat ns a)
- Cybus.Mat: instance (GHC.Show.Show a, Cybus.Mat.ShowMatC ns, Data.Pos.NSC ns) => GHC.Show.Show (Cybus.Mat.Mat ns a)
- Cybus.Mat: instance (TypeError ...) => Cybus.Mat.LeafC (n 'GHC.Base.:| '[])
- Cybus.Mat: instance (TypeError ...) => Cybus.Mat.SliceC (i 'GHC.Base.:| (i1 : is)) (n 'GHC.Base.:| '[])
- Cybus.Mat: instance (TypeError ...) => Cybus.Mat.SliceC' (n' 'GHC.Base.:| (n1' : ns')) (n 'GHC.Base.:| '[])
- Cybus.Mat: instance (c GHC.Types.~ GHC.Types.Char, Data.Pos.NSC ns) => Data.String.IsString (Cybus.Mat.Mat ns c)
- Cybus.Mat: instance (n GHC.Types.~ n') => Cybus.Mat.SliceC' (n' 'GHC.Base.:| '[]) (n 'GHC.Base.:| '[])
- Cybus.Mat: instance (n GHC.Types.~ n') => Cybus.Mat.SliceC' (n' 'GHC.Base.:| '[]) (n 'GHC.Base.:| (m : ns))
- Cybus.Mat: instance (n GHC.Types.~ n', Cybus.Mat.SliceC' (n1' 'GHC.Base.:| ns') (n1 'GHC.Base.:| ns)) => Cybus.Mat.SliceC' (n 'GHC.Base.:| (n1' : ns')) (n' 'GHC.Base.:| (n1 : ns))
- Cybus.Mat: instance Cybus.Fin.FinT 1 n => Cybus.Mat.Row1 (Cybus.Mat.Mat (n 'GHC.Base.:| (m : ns)) a) (Cybus.Mat.Mat (m 'GHC.Base.:| ns) a)
- Cybus.Mat: instance Cybus.Fin.FinT 10 n => Cybus.Mat.Row10 (Cybus.Mat.Mat (n 'GHC.Base.:| (m : ns)) a) (Cybus.Mat.Mat (m 'GHC.Base.:| ns) a)
- Cybus.Mat: instance Cybus.Fin.FinT 2 n => Cybus.Mat.Row2 (Cybus.Mat.Mat (n 'GHC.Base.:| (m : ns)) a) (Cybus.Mat.Mat (m 'GHC.Base.:| ns) a)
- Cybus.Mat: instance Cybus.Fin.FinT 3 n => Cybus.Mat.Row3 (Cybus.Mat.Mat (n 'GHC.Base.:| (m : ns)) a) (Cybus.Mat.Mat (m 'GHC.Base.:| ns) a)
- Cybus.Mat: instance Cybus.Fin.FinT 4 n => Cybus.Mat.Row4 (Cybus.Mat.Mat (n 'GHC.Base.:| (m : ns)) a) (Cybus.Mat.Mat (m 'GHC.Base.:| ns) a)
- Cybus.Mat: instance Cybus.Fin.FinT 5 n => Cybus.Mat.Row5 (Cybus.Mat.Mat (n 'GHC.Base.:| (m : ns)) a) (Cybus.Mat.Mat (m 'GHC.Base.:| ns) a)
- Cybus.Mat: instance Cybus.Fin.FinT 6 n => Cybus.Mat.Row6 (Cybus.Mat.Mat (n 'GHC.Base.:| (m : ns)) a) (Cybus.Mat.Mat (m 'GHC.Base.:| ns) a)
- Cybus.Mat: instance Cybus.Fin.FinT 7 n => Cybus.Mat.Row7 (Cybus.Mat.Mat (n 'GHC.Base.:| (m : ns)) a) (Cybus.Mat.Mat (m 'GHC.Base.:| ns) a)
- Cybus.Mat: instance Cybus.Fin.FinT 8 n => Cybus.Mat.Row8 (Cybus.Mat.Mat (n 'GHC.Base.:| (m : ns)) a) (Cybus.Mat.Mat (m 'GHC.Base.:| ns) a)
- Cybus.Mat: instance Cybus.Fin.FinT 9 n => Cybus.Mat.Row9 (Cybus.Mat.Mat (n 'GHC.Base.:| (m : ns)) a) (Cybus.Mat.Mat (m 'GHC.Base.:| ns) a)
- Cybus.Mat: instance Cybus.Fin.FinT i n => Cybus.Mat.SliceC (i 'GHC.Base.:| '[]) (n 'GHC.Base.:| '[])
- Cybus.Mat: instance Cybus.Fin.FinT i n => Cybus.Mat.SliceC (i 'GHC.Base.:| '[]) (n 'GHC.Base.:| (m : ns))
- Cybus.Mat: instance Cybus.Mat.DotC '[] (r : xs) a b a (Cybus.Mat.Mat (r 'GHC.Base.:| xs) b)
- Cybus.Mat: instance Cybus.Mat.DotC (q : ns) '[] a b (Cybus.Mat.Mat (q 'GHC.Base.:| ns) a) b
- Cybus.Mat: instance Cybus.Mat.DotC (q : ns) (r : xs) a b (Cybus.Mat.Mat (q 'GHC.Base.:| ns) a) (Cybus.Mat.Mat (r 'GHC.Base.:| xs) b)
- Cybus.Mat: instance Cybus.Mat.LeafC (n 'GHC.Base.:| (m : ns))
- Cybus.Mat: instance Cybus.Mat.ListTupleCInternal n => Cybus.Mat.MatTupleC (n 'GHC.Base.:| '[]) a
- Cybus.Mat: instance Cybus.Mat.ShowMatC (m 'GHC.Base.:| ns) => Cybus.Mat.ShowMatC (n 'GHC.Base.:| (m : ns))
- Cybus.Mat: instance Cybus.Mat.ShowMatC (n 'GHC.Base.:| '[])
- Cybus.Mat: instance Cybus.Mat.SnocMatC (1 'GHC.Base.:| '[]) a b
- Cybus.Mat: instance Cybus.Mat.SnocMatC (1 'GHC.Base.:| (n1 : ns)) a b
- Cybus.Mat: instance Data.Pos.NSC ns => Control.Monad.Zip.MonadZip (Cybus.Mat.Mat ns)
- Cybus.Mat: instance Data.Pos.NSC ns => Data.Distributive.Distributive (Cybus.Mat.Mat ns)
- Cybus.Mat: instance Data.Pos.NSC ns => Data.Functor.Bind.Class.Bind (Cybus.Mat.Mat ns)
- Cybus.Mat: instance Data.Pos.NSC ns => Data.Functor.Rep.Representable (Cybus.Mat.Mat ns)
- Cybus.Mat: instance Data.Pos.NSC ns => GHC.Base.Applicative (Cybus.Mat.Mat ns)
- Cybus.Mat: instance Data.Pos.NSC ns => GHC.Base.Monad (Cybus.Mat.Mat ns)
- Cybus.Mat: instance Data.Pos.NSC ns => GHC.Exts.IsList (Cybus.Mat.Mat ns a)
- Cybus.Mat: instance Data.Pos.NSC ns => WithIndex.FoldableWithIndex (Cybus.FinMat.FinMat ns) (Cybus.Mat.Mat ns)
- Cybus.Mat: instance Data.Pos.NSC ns => WithIndex.FunctorWithIndex (Cybus.FinMat.FinMat ns) (Cybus.Mat.Mat ns)
- Cybus.Mat: instance Data.Pos.NSC ns => WithIndex.TraversableWithIndex (Cybus.FinMat.FinMat ns) (Cybus.Mat.Mat ns)
- Cybus.Mat: instance Data.Pos.PosT n => Cybus.Mat.MatConvertersC (n 'GHC.Base.:| '[])
- Cybus.Mat: mm' :: forall n. NSC (NN n) => Mat (NN n) [Int]
- Cybus.NatHelper: instance (Data.Pos.PosT n, Cybus.NatHelper.NestedListC (n1 'GHC.Base.:| ns)) => Cybus.NatHelper.NestedListC (n 'GHC.Base.:| (n1 : ns))
- Cybus.NatHelper: instance Data.Pos.PosT n => Cybus.NatHelper.NestedListC (n 'GHC.Base.:| '[])
+ Cybus.FinMat: class NS (ns :: [Nat])
+ Cybus.FinMat: finMat :: forall ns. NS ns => Int -> Either String (FinMat ns)
+ Cybus.FinMat: instance (TypeError ...) => Cybus.FinMat.FinMatC '[] '[]
+ Cybus.FinMat: instance (TypeError ...) => Cybus.FinMat.FinMatC '[] (n : ns)
+ Cybus.FinMat: instance (TypeError ...) => Cybus.FinMat.NSRangeC 'Cybus.NatHelper.Z (n : ns)
+ Cybus.FinMat: instance (TypeError ...) => Cybus.FinMat.NSRangeC ('Cybus.NatHelper.S ('Cybus.NatHelper.S i)) '[n]
+ Cybus.FinMat: instance (TypeError ...) => Cybus.FinMat.NSRangeC p '[]
+ Cybus.FinMat: instance (is' GHC.Types.~ (i : is), ns' GHC.Types.~ (n : ns), Data.Pos.NS is', Data.Pos.NS ns', Cybus.FinMat.FinMatT is' ns' 1 is' ns') => Cybus.FinMat.FinMatC (i : is) (n : ns)
+ Cybus.FinMat: instance Cybus.FinMat.NSRangeC ('Cybus.NatHelper.S 'Cybus.NatHelper.Z) (n : ns)
+ Cybus.FinMat: instance Cybus.FinMat.NSRangeC ('Cybus.NatHelper.S i) (m : ns) => Cybus.FinMat.NSRangeC ('Cybus.NatHelper.S ('Cybus.NatHelper.S i)) (n : m : ns)
+ Cybus.FinMat: instance Data.Pos.NS ns => GHC.Base.Monoid (Cybus.FinMat.FinMat ns)
+ Cybus.FinMat: instance Data.Pos.NS ns => GHC.Enum.Bounded (Cybus.FinMat.FinMat ns)
+ Cybus.FinMat: instance Data.Pos.NS ns => GHC.Enum.Enum (Cybus.FinMat.FinMat ns)
+ Cybus.FinMat: instance Data.Pos.NS ns => GHC.Num.Num (Cybus.FinMat.FinMat ns)
+ Cybus.FinMat: instance Data.Pos.NS ns => GHC.Read.Read (Cybus.FinMat.FinMat ns)
+ Cybus.FinMat: instance Data.Pos.NS ns => Primus.Num1.Num1 (Cybus.FinMat.FinMat ns)
+ Cybus.FinMat: instance forall a (i :: a) (is :: [a]). (TypeError ...) => Cybus.FinMat.FinMatC (i : is) '[]
+ Cybus.Mat: instance (Cybus.Fin.FinT i n, Cybus.Mat.SliceC (i1 : is) (n1 : ns)) => Cybus.Mat.SliceC (i : i1 : is) (n : n1 : ns)
+ Cybus.Mat: instance (Cybus.Mat.ConsMatCTA '[1] a GHC.Types.~ a, Cybus.Mat.ConsMatCTA '[1] b GHC.Types.~ b, Cybus.Mat.ConsMatCTB '[1] a GHC.Types.~ Cybus.Mat.Eof1, Cybus.Mat.ConsMatCTB '[1] b GHC.Types.~ Cybus.Mat.Eof1) => Cybus.Mat.ConsMatC '[1] a b
+ Cybus.Mat: instance (Cybus.Mat.ConsMatCTA '[n] a GHC.Types.~ a, Cybus.Mat.ConsMatCTA '[n] b GHC.Types.~ b, Cybus.Mat.ConsMatCTB '[n] a GHC.Types.~ Cybus.Mat.Vec (n GHC.TypeNats.- 1) a, Cybus.Mat.ConsMatCTB '[n] b GHC.Types.~ Cybus.Mat.Vec (n GHC.TypeNats.- 1) b) => Cybus.Mat.ConsMatC '[n] a b
+ Cybus.Mat: instance (Cybus.Mat.ConsMatCTA (1 : m : ns) a GHC.Types.~ Cybus.Mat.Mat (m : ns) a, Cybus.Mat.ConsMatCTA (1 : m : ns) b GHC.Types.~ Cybus.Mat.Mat (m : ns) b, Cybus.Mat.ConsMatCTB (1 : m : ns) a GHC.Types.~ Cybus.Mat.EofN, Cybus.Mat.ConsMatCTB (1 : m : ns) b GHC.Types.~ Cybus.Mat.EofN) => Cybus.Mat.ConsMatC (1 : n1 : ns) a b
+ Cybus.Mat: instance (Cybus.Mat.ConsMatCTA (n : m : ns) a GHC.Types.~ Cybus.Mat.Mat (m : ns) a, Cybus.Mat.ConsMatCTA (n : m : ns) b GHC.Types.~ Cybus.Mat.Mat (m : ns) b, Cybus.Mat.ConsMatCTB (n : m : ns) a GHC.Types.~ Cybus.Mat.Mat ((n GHC.TypeNats.- 1) : m : ns) a, Cybus.Mat.ConsMatCTB (n : m : ns) b GHC.Types.~ Cybus.Mat.Mat ((n GHC.TypeNats.- 1) : m : ns) b) => Cybus.Mat.ConsMatC (n : m : ns) a b
+ Cybus.Mat: instance (Cybus.Mat.ConsMatCTB '[n] a GHC.Types.~ Cybus.Mat.Vec (n GHC.TypeNats.- 1) a, Cybus.Mat.ConsMatCTB '[n] b GHC.Types.~ Cybus.Mat.Vec (n GHC.TypeNats.- 1) b) => Cybus.Mat.SnocMatC '[n] a b
+ Cybus.Mat: instance (Cybus.Mat.ConsMatCTB (n : m : ns) a GHC.Types.~ Cybus.Mat.Mat ((n GHC.TypeNats.- 1) : m : ns) a, Cybus.Mat.ConsMatCTB (n : m : ns) a GHC.Types.~ Cybus.Mat.Mat ((n GHC.TypeNats.- 1) : m : ns) b) => Cybus.Mat.SnocMatC (n : m : ns) a b
+ Cybus.Mat: instance (Cybus.Mat.ListTupleCInternal n, Data.Pos.NS (n1 : ns), Cybus.Mat.MatTupleC (n1 : ns) a) => Cybus.Mat.MatTupleC (n : n1 : ns) a
+ Cybus.Mat: instance (Cybus.Mat.MatConvertersC ns, Data.Pos.NS ns, GHC.Read.Read (Cybus.NatHelper.ListNST ns a)) => GHC.Read.Read (Cybus.Mat.Mat ns a)
+ Cybus.Mat: instance (Data.Pos.NS ns, GHC.Enum.Bounded a) => GHC.Enum.Bounded (Cybus.Mat.Mat ns a)
+ Cybus.Mat: instance (Data.Pos.NS ns, GHC.Num.Num a) => GHC.Num.Num (Cybus.Mat.Mat ns a)
+ Cybus.Mat: instance (Data.Pos.NS ns, GHC.Real.Fractional a) => GHC.Real.Fractional (Cybus.Mat.Mat ns a)
+ Cybus.Mat: instance (Data.Pos.PosT n, Cybus.Mat.MatConvertersC (m : ns)) => Cybus.Mat.MatConvertersC (n : m : ns)
+ Cybus.Mat: instance (GHC.Base.Monoid a, Data.Pos.NS ns) => GHC.Base.Monoid (Cybus.Mat.Mat ns a)
+ Cybus.Mat: instance (GHC.Enum.Enum a, GHC.Enum.Bounded a, Data.Pos.NS ns) => GHC.Enum.Enum (Cybus.Mat.Mat ns a)
+ Cybus.Mat: instance (GHC.Show.Show a, Cybus.Mat.ShowMatC ns, Data.Pos.NS ns) => GHC.Show.Show (Cybus.Mat.Mat ns a)
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.LeafC '[]
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.LeafC '[n]
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.MatConvertersC '[]
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.MatTupleC '[] a
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.ShowMatC '[]
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.SliceC '[] '[]
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.SliceC '[] (n : ns)
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.SliceC (i : i1 : is) '[n]
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.SliceC (n' : ns') '[]
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.SliceC' '[] '[]
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.SliceC' '[] (n : ns)
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.SliceC' (n' : n1' : ns') '[n]
+ Cybus.Mat: instance (TypeError ...) => Cybus.Mat.SliceC' (n' : ns') '[]
+ Cybus.Mat: instance (c GHC.Types.~ GHC.Types.Char, Data.Pos.NS ns) => Data.String.IsString (Cybus.Mat.Mat ns c)
+ Cybus.Mat: instance (n GHC.Types.~ n') => Cybus.Mat.SliceC' '[n'] '[n]
+ Cybus.Mat: instance (n GHC.Types.~ n') => Cybus.Mat.SliceC' '[n'] (n : m : ns)
+ Cybus.Mat: instance (n GHC.Types.~ n', Cybus.Mat.SliceC' (n1' : ns') (n1 : ns)) => Cybus.Mat.SliceC' (n : n1' : ns') (n' : n1 : ns)
+ Cybus.Mat: instance Cybus.Fin.FinT 1 n => Cybus.Mat.Row1 (Cybus.Mat.Mat (n : m : ns) a) (Cybus.Mat.Mat (m : ns) a)
+ Cybus.Mat: instance Cybus.Fin.FinT 10 n => Cybus.Mat.Row10 (Cybus.Mat.Mat (n : m : ns) a) (Cybus.Mat.Mat (m : ns) a)
+ Cybus.Mat: instance Cybus.Fin.FinT 2 n => Cybus.Mat.Row2 (Cybus.Mat.Mat (n : m : ns) a) (Cybus.Mat.Mat (m : ns) a)
+ Cybus.Mat: instance Cybus.Fin.FinT 3 n => Cybus.Mat.Row3 (Cybus.Mat.Mat (n : m : ns) a) (Cybus.Mat.Mat (m : ns) a)
+ Cybus.Mat: instance Cybus.Fin.FinT 4 n => Cybus.Mat.Row4 (Cybus.Mat.Mat (n : m : ns) a) (Cybus.Mat.Mat (m : ns) a)
+ Cybus.Mat: instance Cybus.Fin.FinT 5 n => Cybus.Mat.Row5 (Cybus.Mat.Mat (n : m : ns) a) (Cybus.Mat.Mat (m : ns) a)
+ Cybus.Mat: instance Cybus.Fin.FinT 6 n => Cybus.Mat.Row6 (Cybus.Mat.Mat (n : m : ns) a) (Cybus.Mat.Mat (m : ns) a)
+ Cybus.Mat: instance Cybus.Fin.FinT 7 n => Cybus.Mat.Row7 (Cybus.Mat.Mat (n : m : ns) a) (Cybus.Mat.Mat (m : ns) a)
+ Cybus.Mat: instance Cybus.Fin.FinT 8 n => Cybus.Mat.Row8 (Cybus.Mat.Mat (n : m : ns) a) (Cybus.Mat.Mat (m : ns) a)
+ Cybus.Mat: instance Cybus.Fin.FinT 9 n => Cybus.Mat.Row9 (Cybus.Mat.Mat (n : m : ns) a) (Cybus.Mat.Mat (m : ns) a)
+ Cybus.Mat: instance Cybus.Fin.FinT i n => Cybus.Mat.SliceC '[i] '[n]
+ Cybus.Mat: instance Cybus.Fin.FinT i n => Cybus.Mat.SliceC '[i] (n : m : ns)
+ Cybus.Mat: instance Cybus.Mat.DotC '[] (r : xs) a b a (Cybus.Mat.Mat (r : xs) b)
+ Cybus.Mat: instance Cybus.Mat.DotC (q : ns) '[] a b (Cybus.Mat.Mat (q : ns) a) b
+ Cybus.Mat: instance Cybus.Mat.DotC (q : ns) (r : xs) a b (Cybus.Mat.Mat (q : ns) a) (Cybus.Mat.Mat (r : xs) b)
+ Cybus.Mat: instance Cybus.Mat.LeafC (n : m : ns)
+ Cybus.Mat: instance Cybus.Mat.ListTupleCInternal n => Cybus.Mat.MatTupleC '[n] a
+ Cybus.Mat: instance Cybus.Mat.ShowMatC '[n]
+ Cybus.Mat: instance Cybus.Mat.ShowMatC (m : ns) => Cybus.Mat.ShowMatC (n : m : ns)
+ Cybus.Mat: instance Cybus.Mat.SnocMatC '[1] a b
+ Cybus.Mat: instance Cybus.Mat.SnocMatC (1 : n1 : ns) a b
+ Cybus.Mat: instance Data.Pos.NS ns => Control.Monad.Zip.MonadZip (Cybus.Mat.Mat ns)
+ Cybus.Mat: instance Data.Pos.NS ns => Data.Distributive.Distributive (Cybus.Mat.Mat ns)
+ Cybus.Mat: instance Data.Pos.NS ns => Data.Functor.Bind.Class.Bind (Cybus.Mat.Mat ns)
+ Cybus.Mat: instance Data.Pos.NS ns => Data.Functor.Rep.Representable (Cybus.Mat.Mat ns)
+ Cybus.Mat: instance Data.Pos.NS ns => GHC.Base.Applicative (Cybus.Mat.Mat ns)
+ Cybus.Mat: instance Data.Pos.NS ns => GHC.Base.Monad (Cybus.Mat.Mat ns)
+ Cybus.Mat: instance Data.Pos.NS ns => GHC.Exts.IsList (Cybus.Mat.Mat ns a)
+ Cybus.Mat: instance Data.Pos.NS ns => WithIndex.FoldableWithIndex (Cybus.FinMat.FinMat ns) (Cybus.Mat.Mat ns)
+ Cybus.Mat: instance Data.Pos.NS ns => WithIndex.FunctorWithIndex (Cybus.FinMat.FinMat ns) (Cybus.Mat.Mat ns)
+ Cybus.Mat: instance Data.Pos.NS ns => WithIndex.TraversableWithIndex (Cybus.FinMat.FinMat ns) (Cybus.Mat.Mat ns)
+ Cybus.Mat: instance Data.Pos.PosT n => Cybus.Mat.MatConvertersC '[n]
+ Cybus.NatHelper: instance (Data.Pos.PosT n, Cybus.NatHelper.NestedListC (n1 : ns)) => Cybus.NatHelper.NestedListC (n : n1 : ns)
+ Cybus.NatHelper: instance (TypeError ...) => Cybus.NatHelper.NestedListC '[]
+ Cybus.NatHelper: instance Data.Pos.PosT n => Cybus.NatHelper.NestedListC '[n]
- Cybus.FinMat: _i1 :: Lens' (FinMat (n :| ns)) (Fin n)
+ Cybus.FinMat: _i1 :: Lens' (FinMat (n : ns)) (Fin n)
- Cybus.FinMat: _i10 :: Lens' (FinMat (n1 :| (n2 : (n3 : (n4 : (n5 : (n6 : (n7 : (n8 : (n9 : (n : ns))))))))))) (Fin n)
+ Cybus.FinMat: _i10 :: Lens' (FinMat (n1 : (n2 : (n3 : (n4 : (n5 : (n6 : (n7 : (n8 : (n9 : (n : ns))))))))))) (Fin n)
- Cybus.FinMat: _i2 :: Lens' (FinMat (n1 :| (n : ns))) (Fin n)
+ Cybus.FinMat: _i2 :: Lens' (FinMat (n1 : (n : ns))) (Fin n)
- Cybus.FinMat: _i3 :: Lens' (FinMat (n1 :| (n2 : (n : ns)))) (Fin n)
+ Cybus.FinMat: _i3 :: Lens' (FinMat (n1 : (n2 : (n : ns)))) (Fin n)
- Cybus.FinMat: _i4 :: Lens' (FinMat (n1 :| (n2 : (n3 : (n : ns))))) (Fin n)
+ Cybus.FinMat: _i4 :: Lens' (FinMat (n1 : (n2 : (n3 : (n : ns))))) (Fin n)
- Cybus.FinMat: _i5 :: Lens' (FinMat (n1 :| (n2 : (n3 : (n4 : (n : ns)))))) (Fin n)
+ Cybus.FinMat: _i5 :: Lens' (FinMat (n1 : (n2 : (n3 : (n4 : (n : ns)))))) (Fin n)
- Cybus.FinMat: _i6 :: Lens' (FinMat (n1 :| (n2 : (n3 : (n4 : (n5 : (n : ns))))))) (Fin n)
+ Cybus.FinMat: _i6 :: Lens' (FinMat (n1 : (n2 : (n3 : (n4 : (n5 : (n : ns))))))) (Fin n)
- Cybus.FinMat: _i7 :: Lens' (FinMat (n1 :| (n2 : (n3 : (n4 : (n5 : (n6 : (n : ns)))))))) (Fin n)
+ Cybus.FinMat: _i7 :: Lens' (FinMat (n1 : (n2 : (n3 : (n4 : (n5 : (n6 : (n : ns)))))))) (Fin n)
- Cybus.FinMat: _i8 :: Lens' (FinMat (n1 :| (n2 : (n3 : (n4 : (n5 : (n6 : (n7 : (n : ns))))))))) (Fin n)
+ Cybus.FinMat: _i8 :: Lens' (FinMat (n1 : (n2 : (n3 : (n4 : (n5 : (n6 : (n7 : (n : ns))))))))) (Fin n)
- Cybus.FinMat: _i9 :: Lens' (FinMat (n1 :| (n2 : (n3 : (n4 : (n5 : (n6 : (n7 : (n8 : (n : ns)))))))))) (Fin n)
+ Cybus.FinMat: _i9 :: Lens' (FinMat (n1 : (n2 : (n3 : (n4 : (n5 : (n6 : (n7 : (n8 : (n : ns)))))))))) (Fin n)
- Cybus.FinMat: fromNSP :: NSC ns => NonEmpty Pos
+ Cybus.FinMat: fromNSP :: NS ns => NonEmpty Pos
- Cybus.FinMat: fromNSTotalP :: NSC ns => Pos
+ Cybus.FinMat: fromNSTotalP :: NS ns => Pos
- Cybus.FinMat: mkFinMatC :: forall ns. NSC ns => Int -> NonEmpty Pos -> Either String (FinMat ns)
+ Cybus.FinMat: mkFinMatC :: forall ns. NS ns => Int -> NonEmpty Pos -> Either String (FinMat ns)
- Cybus.FinMat: nonEmptyToFinMat :: forall ns. NSC ns => NonEmpty Pos -> Either String (FinMat ns)
+ Cybus.FinMat: nonEmptyToFinMat :: forall ns. NS ns => NonEmpty Pos -> Either String (FinMat ns)
- Cybus.FinMat: nsLengthP :: NSC ns => Pos
+ Cybus.FinMat: nsLengthP :: NS ns => Pos
- Cybus.FinMat: pattern FinMat :: forall (ns :: NonEmpty Nat). Int -> NonEmpty Pos -> FinMat ns
+ Cybus.FinMat: pattern FinMat :: forall (ns :: [Nat]). Int -> NonEmpty Pos -> FinMat ns
- Cybus.FinMat: pattern FinMatU :: forall (ns :: NonEmpty Nat). (HasCallStack, NSC ns) => Int -> NonEmpty Pos -> FinMat ns
+ Cybus.FinMat: pattern FinMatU :: forall (ns :: [Nat]). (HasCallStack, NS ns) => Int -> NonEmpty Pos -> FinMat ns
- Cybus.FinMat: readFinMat :: NSC ns => ReadS (FinMat ns)
+ Cybus.FinMat: readFinMat :: NS ns => ReadS (FinMat ns)
- Cybus.FinMat: readFinMatP :: forall ns. NSC ns => ReadP (FinMat ns)
+ Cybus.FinMat: readFinMatP :: forall ns. NS ns => ReadP (FinMat ns)
- Cybus.FinMat: toFinMatFromPos :: forall (i :: Nat) ns. (NSC ns, i <! Product1T ns) => FinMat ns
+ Cybus.FinMat: toFinMatFromPos :: forall (i :: Nat) ns. (NS ns, i <! ProductT ns) => FinMat ns
- Cybus.Mat: (.::) :: forall n m ns a. Mat (m :| ns) a -> Mat (n :| (m : ns)) a -> Mat ((1 + n) :| (m : ns)) a
+ Cybus.Mat: (.::) :: forall n m ns a. Mat (m : ns) a -> Mat (n : (m : ns)) a -> Mat ((1 + n) : (m : ns)) a
- Cybus.Mat: (.||) :: forall m ns a. Mat (m :| ns) a -> Mat (m :| ns) a -> Mat (2 :| (m : ns)) a
+ Cybus.Mat: (.||) :: forall m ns a. Mat (m : ns) a -> Mat (m : ns) a -> Mat (2 : (m : ns)) a
- Cybus.Mat: _c1 :: FinT 1 m => Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _c1 :: FinT 1 m => Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _c10 :: FinT 10 m => Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _c10 :: FinT 10 m => Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _c2 :: FinT 2 m => Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _c2 :: FinT 2 m => Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _c3 :: FinT 3 m => Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _c3 :: FinT 3 m => Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _c4 :: FinT 4 m => Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _c4 :: FinT 4 m => Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _c5 :: FinT 5 m => Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _c5 :: FinT 5 m => Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _c6 :: FinT 6 m => Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _c6 :: FinT 6 m => Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _c7 :: FinT 7 m => Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _c7 :: FinT 7 m => Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _c8 :: FinT 8 m => Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _c8 :: FinT 8 m => Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _c9 :: FinT 9 m => Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _c9 :: FinT 9 m => Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _col :: forall (i :: Nat) n m ns a. FinT i m => Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _col :: forall (i :: Nat) n m ns a. FinT i m => Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _col' :: forall n m ns a. Fin m -> Lens' (Mat (n :| (m : ns)) a) (Mat (n :| ns) a)
+ Cybus.Mat: _col' :: forall n m ns a. Fin m -> Lens' (Mat (n : (m : ns)) a) (Mat (n : ns) a)
- Cybus.Mat: _row :: forall (i :: Nat) (ns :: NonEmpty Nat) a. SliceC (i :| '[]) ns => Lens' (Mat ns a) (SliceT (i :| '[]) ns a)
+ Cybus.Mat: _row :: forall (i :: Nat) (ns :: [Nat]) a. SliceC '[i] ns => Lens' (Mat ns a) (SliceT '[i] ns a)
- Cybus.Mat: _row' :: forall (n :: Nat) (ns :: NonEmpty Nat) a. SliceC' (n :| '[]) ns => Fin n -> Lens' (Mat ns a) (SliceT' (n :| '[]) ns a)
+ Cybus.Mat: _row' :: forall (n :: Nat) (ns :: [Nat]) a. SliceC' '[n] ns => Fin n -> Lens' (Mat ns a) (SliceT' '[n] ns a)
- Cybus.Mat: _rows :: forall n m ns a b. Iso (Mat (n :| (m : ns)) a) (Mat (n :| (m : ns)) b) (Vec n (Mat (m :| ns) a)) (Vec n (Mat (m :| ns) b))
+ Cybus.Mat: _rows :: forall n m ns a b. Iso (Mat (n : (m : ns)) a) (Mat (n : (m : ns)) b) (Vec n (Mat (m : ns) a)) (Vec n (Mat (m : ns) b))
- Cybus.Mat: _transposeMat :: Iso (Mat (n :| (m : ns)) a) (Mat (n :| (m : ns)) b) (Mat (m :| (n : ns)) a) (Mat (m :| (n : ns)) b)
+ Cybus.Mat: _transposeMat :: Iso (Mat (n : (m : ns)) a) (Mat (n : (m : ns)) b) (Mat (m : (n : ns)) a) (Mat (m : (n : ns)) b)
- Cybus.Mat: appendH :: forall n m m' ns a. Mat (n :| (m : ns)) a -> Mat (n :| (m' : ns)) a -> Mat (n :| ((m + m') : ns)) a
+ Cybus.Mat: appendH :: forall n m m' ns a. Mat (n : (m : ns)) a -> Mat (n : (m' : ns)) a -> Mat (n : ((m + m') : ns)) a
- Cybus.Mat: appendV :: Mat (n :| ns) a -> Mat (n' :| ns) a -> Mat ((n + n') :| ns) a
+ Cybus.Mat: appendV :: Mat (n : ns) a -> Mat (n' : ns) a -> Mat ((n + n') : ns) a
- Cybus.Mat: buildMat :: forall ns a b. NSC ns => ([FinMat ns] -> [FinMat ns] -> b -> FinMat ns -> (b, a)) -> b -> (b, Mat ns a)
+ Cybus.Mat: buildMat :: forall ns a b. NS ns => ([FinMat ns] -> [FinMat ns] -> b -> FinMat ns -> (b, a)) -> b -> (b, Mat ns a)
- Cybus.Mat: cartesian :: (a -> b -> c) -> Mat (n :| ns) a -> Mat (n' :| ns') b -> Mat (n :| (ns ++ (n' : ns'))) c
+ Cybus.Mat: cartesian :: (a -> b -> c) -> Mat (n : ns) a -> Mat (n' : ns') b -> Mat (n : (ns ++ (n' : ns'))) c
- Cybus.Mat: concatMat :: forall (n :: Nat) (ns :: [Nat]) (m :: Nat) (ms :: [Nat]) a. Mat (n :| ns) (Mat (m :| ms) a) -> Mat (n :| (ns ++ (m : ms))) a
+ Cybus.Mat: concatMat :: forall (n :: Nat) (ns :: [Nat]) (m :: Nat) (ms :: [Nat]) a. Mat (n : ns) (Mat (m : ms) a) -> Mat (n : (ns ++ (m : ms))) a
- Cybus.Mat: deleteCol :: forall (i :: Nat) (n :: Nat) (n1 :: Nat) ns a. FinT i (1 + n1) => Mat (n :| ((1 + n1) : ns)) a -> Mat (n :| (n1 : ns)) a
+ Cybus.Mat: deleteCol :: forall (i :: Nat) (n :: Nat) (n1 :: Nat) ns a. FinT i (1 + n1) => Mat (n : ((1 + n1) : ns)) a -> Mat (n : (n1 : ns)) a
- Cybus.Mat: deleteCol' :: forall (n :: Nat) (n1 :: Nat) ns a. Fin (1 + n1) -> Mat (n :| ((1 + n1) : ns)) a -> Mat (n :| (n1 : ns)) a
+ Cybus.Mat: deleteCol' :: forall (n :: Nat) (n1 :: Nat) ns a. Fin (1 + n1) -> Mat (n : ((1 + n1) : ns)) a -> Mat (n : (n1 : ns)) a
- Cybus.Mat: deleteRow :: forall (i :: Nat) (n :: Nat) (ns :: [Nat]) a. FinT i (1 + n) => Mat ((1 + n) :| ns) a -> Mat (n :| ns) a
+ Cybus.Mat: deleteRow :: forall (i :: Nat) (n :: Nat) (ns :: [Nat]) a. FinT i (1 + n) => Mat ((1 + n) : ns) a -> Mat (n : ns) a
- Cybus.Mat: deleteRow' :: forall n ns a. Fin (1 + n) -> Mat ((1 + n) :| ns) a -> Mat (n :| ns) a
+ Cybus.Mat: deleteRow' :: forall n ns a. Fin (1 + n) -> Mat ((1 + n) : ns) a -> Mat (n : ns) a
- Cybus.Mat: diagonal :: Mat (n :| (n : ns)) a -> Mat (n :| ns) a
+ Cybus.Mat: diagonal :: Mat (n : (n : ns)) a -> Mat (n : ns) a
- Cybus.Mat: dim10 :: Mat (n :| '[m, p, q, r, s, t, u, v, w]) a -> Mat (n :| '[m, p, q, r, s, t, u, v, w]) a
+ Cybus.Mat: dim10 :: Mat '[n, m, p, q, r, s, t, u, v, w] a -> Mat '[n, m, p, q, r, s, t, u, v, w] a
- Cybus.Mat: dim3 :: Mat (n :| '[m, p]) a -> Mat (n :| '[m, p]) a
+ Cybus.Mat: dim3 :: Mat '[n, m, p] a -> Mat '[n, m, p] a
- Cybus.Mat: dim4 :: Mat (n :| '[m, p, q]) a -> Mat (n :| '[m, p, q]) a
+ Cybus.Mat: dim4 :: Mat '[n, m, p, q] a -> Mat '[n, m, p, q] a
- Cybus.Mat: dim5 :: Mat (n :| '[m, p, q, r]) a -> Mat (n :| '[m, p, q, r]) a
+ Cybus.Mat: dim5 :: Mat '[n, m, p, q, r] a -> Mat '[n, m, p, q, r] a
- Cybus.Mat: dim6 :: Mat (n :| '[m, p, q, r, s]) a -> Mat (n :| '[m, p, q, r, s]) a
+ Cybus.Mat: dim6 :: Mat '[n, m, p, q, r, s] a -> Mat '[n, m, p, q, r, s] a
- Cybus.Mat: dim7 :: Mat (n :| '[m, p, q, r, s, t]) a -> Mat (n :| '[m, p, q, r, s, t]) a
+ Cybus.Mat: dim7 :: Mat '[n, m, p, q, r, s, t] a -> Mat '[n, m, p, q, r, s, t] a
- Cybus.Mat: dim8 :: Mat (n :| '[m, p, q, r, s, t, u]) a -> Mat (n :| '[m, p, q, r, s, t, u]) a
+ Cybus.Mat: dim8 :: Mat '[n, m, p, q, r, s, t, u] a -> Mat '[n, m, p, q, r, s, t, u] a
- Cybus.Mat: dim9 :: Mat (n :| '[m, p, q, r, s, t, u, v]) a -> Mat (n :| '[m, p, q, r, s, t, u, v]) a
+ Cybus.Mat: dim9 :: Mat '[n, m, p, q, r, s, t, u, v] a -> Mat '[n, m, p, q, r, s, t, u, v] a
- Cybus.Mat: dotC :: DotC ns ns' a b fa fb => (fa -> fb -> c) -> (NonEmpty c -> d) -> Mat (n :| (m : ns)) a -> Mat (m :| (p : ns')) b -> Mat2 n p d
+ Cybus.Mat: dotC :: DotC ns ns' a b fa fb => (fa -> fb -> c) -> (NonEmpty c -> d) -> Mat (n : (m : ns)) a -> Mat (m : (p : ns')) b -> Mat2 n p d
- Cybus.Mat: finMatMatrix :: forall ns. NSC ns => Mat ns (FinMat ns)
+ Cybus.Mat: finMatMatrix :: forall ns. NS ns => Mat ns (FinMat ns)
- Cybus.Mat: finMatMatrix' :: forall ns x. NSC ns => Mat ns x -> Mat ns (FinMat ns)
+ Cybus.Mat: finMatMatrix' :: forall ns x. NS ns => Mat ns x -> Mat ns (FinMat ns)
- Cybus.Mat: finMatRows :: forall ns. NSC ns => NonEmpty (FinMat ns)
+ Cybus.Mat: finMatRows :: forall ns. NS ns => NonEmpty (FinMat ns)
- Cybus.Mat: findMatElems :: NSC ns => (a -> Bool) -> Mat ns a -> [(FinMat ns, a)]
+ Cybus.Mat: findMatElems :: NS ns => (a -> Bool) -> Mat ns a -> [(FinMat ns, a)]
- Cybus.Mat: foldLeaf :: LeafC ns => (FinMat ns -> c -> Vec (Last1T ns) a -> c) -> c -> Mat ns a -> c
+ Cybus.Mat: foldLeaf :: LeafC ns => (FinMat ns -> c -> Vec (LastT ns) a -> c) -> c -> Mat ns a -> c
- Cybus.Mat: foldMapLeaf :: (Monoid z, LeafC ns) => (FinMat ns -> Vec (Last1T ns) a -> z) -> Mat ns a -> z
+ Cybus.Mat: foldMapLeaf :: (Monoid z, LeafC ns) => (FinMat ns -> Vec (LastT ns) a -> z) -> Mat ns a -> z
- Cybus.Mat: foldMapLeafR :: (Monoid z, LeafC ns) => (FinMat ns -> Vec (Last1T ns) a -> z) -> Mat ns a -> z
+ Cybus.Mat: foldMapLeafR :: (Monoid z, LeafC ns) => (FinMat ns -> Vec (LastT ns) a -> z) -> Mat ns a -> z
- Cybus.Mat: fromLeavesInternalC :: LeafC ns => Mat (Init1T ns) (Vec (Last1T ns) a) -> Mat ns a
+ Cybus.Mat: fromLeavesInternalC :: LeafC ns => Mat (InitT ns) (Vec (LastT ns) a) -> Mat ns a
- Cybus.Mat: gen :: forall ns a. NSC ns => (Int -> a) -> Mat ns a
+ Cybus.Mat: gen :: forall ns a. NS ns => (Int -> a) -> Mat ns a
- Cybus.Mat: gen' :: forall ns a. NSC ns => ([Int] -> a) -> Mat ns a
+ Cybus.Mat: gen' :: forall ns a. NS ns => ([Int] -> a) -> Mat ns a
- Cybus.Mat: indexRow :: Fin n -> Mat (n :| (m : ns)) a -> Mat (m :| ns) a
+ Cybus.Mat: indexRow :: Fin n -> Mat (n : (m : ns)) a -> Mat (m : ns) a
- Cybus.Mat: insertCol :: forall (i :: Nat) (n :: Nat) (n1 :: Nat) ns a. FinT i (1 + n1) => Mat (n :| ns) a -> Mat (n :| (n1 : ns)) a -> Mat (n :| ((1 + n1) : ns)) a
+ Cybus.Mat: insertCol :: forall (i :: Nat) (n :: Nat) (n1 :: Nat) ns a. FinT i (1 + n1) => Mat (n : ns) a -> Mat (n : (n1 : ns)) a -> Mat (n : ((1 + n1) : ns)) a
- Cybus.Mat: insertCol' :: forall (n :: Nat) (n1 :: Nat) ns a. Fin (1 + n1) -> Mat (n :| ns) a -> Mat (n :| (n1 : ns)) a -> Mat (n :| ((1 + n1) : ns)) a
+ Cybus.Mat: insertCol' :: forall (n :: Nat) (n1 :: Nat) ns a. Fin (1 + n1) -> Mat (n : ns) a -> Mat (n : (n1 : ns)) a -> Mat (n : ((1 + n1) : ns)) a
- Cybus.Mat: insertRow :: forall i n m ns a. FinT i (1 + n) => Mat (m :| ns) a -> Mat (n :| (m : ns)) a -> Mat ((1 + n) :| (m : ns)) a
+ Cybus.Mat: insertRow :: forall i n m ns a. FinT i (1 + n) => Mat (m : ns) a -> Mat (n : (m : ns)) a -> Mat ((1 + n) : (m : ns)) a
- Cybus.Mat: insertRow' :: forall n m ns a. Fin (1 + n) -> Mat (m :| ns) a -> Mat (n :| (m : ns)) a -> Mat ((1 + n) :| (m : ns)) a
+ Cybus.Mat: insertRow' :: forall n m ns a. Fin (1 + n) -> Mat (m : ns) a -> Mat (n : (m : ns)) a -> Mat ((1 + n) : (m : ns)) a
- Cybus.Mat: ixMat :: forall (ns :: NonEmpty Nat) a. FinMat ns -> Lens' (Mat ns a) a
+ Cybus.Mat: ixMat :: forall (ns :: [Nat]) a. FinMat ns -> Lens' (Mat ns a) a
- Cybus.Mat: ixMat' :: forall (is :: NonEmpty Nat) (ns :: NonEmpty Nat) a. FinMatC is ns => Lens' (Mat ns a) a
+ Cybus.Mat: ixMat' :: forall (is :: [Nat]) (ns :: [Nat]) a. FinMatC is ns => Lens' (Mat ns a) a
- Cybus.Mat: ixSlice :: forall (is :: NonEmpty Nat) (ns :: NonEmpty Nat) a. SliceC is ns => Lens' (Mat ns a) (SliceT is ns a)
+ Cybus.Mat: ixSlice :: forall (is :: [Nat]) (ns :: [Nat]) a. SliceC is ns => Lens' (Mat ns a) (SliceT is ns a)
- Cybus.Mat: ixSlice' :: forall (ns' :: NonEmpty Nat) (ns :: NonEmpty Nat) a. SliceC' ns' ns => FinMat ns' -> Lens' (Mat ns a) (SliceT' ns' ns a)
+ Cybus.Mat: ixSlice' :: forall (ns' :: [Nat]) (ns :: [Nat]) a. SliceC' ns' ns => FinMat ns' -> Lens' (Mat ns a) (SliceT' ns' ns a)
- Cybus.Mat: izipWith :: NSC ns => (FinMat ns -> a -> b -> c) -> Mat ns a -> Mat ns b -> Mat ns c
+ Cybus.Mat: izipWith :: NS ns => (FinMat ns -> a -> b -> c) -> Mat ns a -> Mat ns b -> Mat ns c
- Cybus.Mat: izipWithM :: (NSC ns, Applicative f) => (FinMat ns -> a -> b -> f c) -> Mat ns a -> Mat ns b -> f (Mat ns c)
+ Cybus.Mat: izipWithM :: (NS ns, Applicative f) => (FinMat ns -> a -> b -> f c) -> Mat ns a -> Mat ns b -> f (Mat ns c)
- Cybus.Mat: mapCols :: forall n m ns a b. (FinMat (m :| (n : ns)) -> Vec (Last1T (n :| ns)) a -> Vec (Last1T (n :| ns)) b) -> Mat (n :| (m : ns)) a -> Mat (n :| (m : ns)) b
+ Cybus.Mat: mapCols :: forall n m ns a b. (FinMat (m : (n : ns)) -> Vec (LastT (n : ns)) a -> Vec (LastT (n : ns)) b) -> Mat (n : (m : ns)) a -> Mat (n : (m : ns)) b
- Cybus.Mat: mapCols' :: forall n m ns a b c. (FinMat (m :| (n : ns)) -> c -> Vec (Last1T (n :| ns)) a -> (c, Vec (Last1T (n :| ns)) b)) -> c -> Mat (n :| (m : ns)) a -> (c, Mat (n :| (m : ns)) b)
+ Cybus.Mat: mapCols' :: forall n m ns a b c. (FinMat (m : (n : ns)) -> c -> Vec (LastT (n : ns)) a -> (c, Vec (LastT (n : ns)) b)) -> c -> Mat (n : (m : ns)) a -> (c, Mat (n : (m : ns)) b)
- Cybus.Mat: mapLeaf :: LeafC ns => (FinMat ns -> Vec (Last1T ns) a -> b) -> Mat ns a -> Mat (Init1T ns) b
+ Cybus.Mat: mapLeaf :: LeafC ns => (FinMat ns -> Vec (LastT ns) a -> b) -> Mat ns a -> Mat (InitT ns) b
- Cybus.Mat: mapLeafS :: LeafC ns => (FinMat ns -> c -> Vec (Last1T ns) a -> (c, b)) -> c -> Mat ns a -> (c, Mat (Init1T ns) b)
+ Cybus.Mat: mapLeafS :: LeafC ns => (FinMat ns -> c -> Vec (LastT ns) a -> (c, b)) -> c -> Mat ns a -> (c, Mat (InitT ns) b)
- Cybus.Mat: mapLeafSimple :: LeafC ns => (FinMat ns -> Vec (Last1T ns) a -> Vec (Last1T ns) b) -> Mat ns a -> Mat ns b
+ Cybus.Mat: mapLeafSimple :: LeafC ns => (FinMat ns -> Vec (LastT ns) a -> Vec (LastT ns) b) -> Mat ns a -> Mat ns b
- Cybus.Mat: mapLeafSimpleS :: LeafC ns => (FinMat ns -> c -> Vec (Last1T ns) a -> (c, Vec (Last1T ns) b)) -> c -> Mat ns a -> (c, Mat ns b)
+ Cybus.Mat: mapLeafSimpleS :: LeafC ns => (FinMat ns -> c -> Vec (LastT ns) a -> (c, Vec (LastT ns) b)) -> c -> Mat ns a -> (c, Mat ns b)
- Cybus.Mat: mat :: forall ns a. (HasCallStack, NSC ns) => [a] -> Mat ns a
+ Cybus.Mat: mat :: forall ns a. (HasCallStack, NS ns) => [a] -> Mat ns a
- Cybus.Mat: mat' :: forall ns a. (HasCallStack, NSC ns) => [a] -> Mat ns a
+ Cybus.Mat: mat' :: forall ns a. (HasCallStack, NS ns) => [a] -> Mat ns a
- Cybus.Mat: mkMatC :: forall ns a. NSC ns => Vector a -> NonEmpty Pos -> Either String (Mat ns a)
+ Cybus.Mat: mkMatC :: forall ns a. NS ns => Vector a -> NonEmpty Pos -> Either String (Mat ns a)
- Cybus.Mat: mm :: forall n. NSC (NN n) => Mat (NN n) Int
+ Cybus.Mat: mm :: forall ns. NS ns => Mat ns Int
- Cybus.Mat: nonEmptyMatsToMat :: forall n m ns a t. (Foldable1 t, PosT n) => t (Mat (m :| ns) a) -> Either String (Mat (n :| (m : ns)) a)
+ Cybus.Mat: nonEmptyMatsToMat :: forall n m ns a t. (Foldable1 t, PosT n) => t (Mat (m : ns) a) -> Either String (Mat (n : (m : ns)) a)
- Cybus.Mat: pattern Mat :: forall (ns :: NonEmpty Nat) a. Vector a -> NonEmpty Pos -> Mat ns a
+ Cybus.Mat: pattern Mat :: forall (ns :: [Nat]) a. Vector a -> NonEmpty Pos -> Mat ns a
- Cybus.Mat: pattern MatU :: forall (ns :: NonEmpty Nat) a. (NSC ns, HasCallStack) => Vector a -> NonEmpty Pos -> Mat ns a
+ Cybus.Mat: pattern MatU :: forall (ns :: [Nat]) a. (NS ns, HasCallStack) => Vector a -> NonEmpty Pos -> Mat ns a
- Cybus.Mat: pureMat :: forall ns a. NSC ns => a -> Mat ns a
+ Cybus.Mat: pureMat :: forall ns a. NS ns => a -> Mat ns a
- Cybus.Mat: readMat :: forall ns a. (MatConvertersC ns, NSC ns, Read (ListNST ns a)) => ReadS (Mat ns a)
+ Cybus.Mat: readMat :: forall ns a. (MatConvertersC ns, NS ns, Read (ListNST ns a)) => ReadS (Mat ns a)
- Cybus.Mat: readMat2 :: (MatConvertersC (n :| '[m]), PosT n, PosT m, Read [[a]]) => ReadS (Mat2 n m a)
+ Cybus.Mat: readMat2 :: (MatConvertersC '[n, m], PosT n, PosT m, Read [[a]]) => ReadS (Mat2 n m a)
- Cybus.Mat: readMatP :: forall ns a. (MatConvertersC ns, NSC ns, Read (ListNST ns a)) => ShowOpts -> ReadP (Mat ns a)
+ Cybus.Mat: readMatP :: forall ns a. (MatConvertersC ns, NS ns, Read (ListNST ns a)) => ShowOpts -> ReadP (Mat ns a)
- Cybus.Mat: readVec :: (MatConvertersC (n :| '[]), PosT n, Read [a]) => ReadS (Vec n a)
+ Cybus.Mat: readVec :: (MatConvertersC '[n], PosT n, Read [a]) => ReadS (Vec n a)
- Cybus.Mat: redim :: forall ms ns a. (NSC ms, Product1T ns ~ Product1T ms) => Mat ns a -> Mat ms a
+ Cybus.Mat: redim :: forall ms ns a. (NS ms, ProductT ns ~ ProductT ms) => Mat ns a -> Mat ms a
- Cybus.Mat: replicateMat :: forall n n1 ns a. PosT n => Mat (n1 :| ns) a -> Mat (n :| (n1 : ns)) a
+ Cybus.Mat: replicateMat :: forall n n1 ns a. PosT n => Mat (n1 : ns) a -> Mat (n : (n1 : ns)) a
- Cybus.Mat: reverseDim :: Mat ns a -> Mat (Reverse1T ns) a
+ Cybus.Mat: reverseDim :: Mat ns a -> Mat (ReverseT ns) a
- Cybus.Mat: rows :: forall n m ns a. Mat (n :| (m : ns)) a -> Vec n (Mat (m :| ns) a)
+ Cybus.Mat: rows :: forall n m ns a. Mat (n : (m : ns)) a -> Vec n (Mat (m : ns) a)
- Cybus.Mat: rowsToMat :: forall x n m ns a. Vec x (Fin n) -> Mat (n :| (m : ns)) a -> Mat (x :| (m : ns)) a
+ Cybus.Mat: rowsToMat :: forall x n m ns a. Vec x (Fin n) -> Mat (n : (m : ns)) a -> Mat (x : (m : ns)) a
- Cybus.Mat: se2 :: forall n ns a. Mat (n :| ns) a -> Mat (1 :| (n : ns)) a
+ Cybus.Mat: se2 :: forall n ns a. Mat (n : ns) a -> Mat (1 : (n : ns)) a
- Cybus.Mat: slice :: forall is ns a z. (z ~ SliceToFinMatT is ns, NSC is, NSC ns, NSC z, SliceC' z ns) => Mat ns a -> SliceT' z ns a
+ Cybus.Mat: slice :: forall is ns a z. (z ~ SliceToFinMatT is ns, NS is, NS ns, NS z, SliceC' z ns) => Mat ns a -> SliceT' z ns a
- Cybus.Mat: sliceToFinMat :: forall is ns. (NSC (SliceToFinMatT is ns), NSC is, NSC ns) => FinMat (SliceToFinMatT is ns)
+ Cybus.Mat: sliceToFinMat :: forall is ns. (NS (SliceToFinMatT is ns), NS is, NS ns) => FinMat (SliceToFinMatT is ns)
- Cybus.Mat: sliceUpdate :: forall is ns a z. (z ~ SliceToFinMatT is ns, NSC is, NSC ns, NSC z, SliceC' z ns) => Mat ns a -> SliceT' z ns a -> Mat ns a
+ Cybus.Mat: sliceUpdate :: forall is ns a z. (z ~ SliceToFinMatT is ns, NS is, NS ns, NS z, SliceC' z ns) => Mat ns a -> SliceT' z ns a -> Mat ns a
- Cybus.Mat: subsetCols :: forall i j m n ns a. DiffTC i j n => Mat (m :| (n : ns)) a -> Mat (m :| (DiffT i j n : ns)) a
+ Cybus.Mat: subsetCols :: forall i j m n ns a. DiffTC i j n => Mat (m : (n : ns)) a -> Mat (m : (DiffT i j n : ns)) a
- Cybus.Mat: subsetRows :: forall i j n ns a. DiffTC i j n => Mat (n :| ns) a -> Mat (DiffT i j n :| ns) a
+ Cybus.Mat: subsetRows :: forall i j n ns a. DiffTC i j n => Mat (n : ns) a -> Mat (DiffT i j n : ns) a
- Cybus.Mat: swapCol :: forall (i :: Nat) (j :: Nat) (n :: Nat) (n1 :: Nat) ns a. (FinT i n1, FinT j n1) => Mat (n :| (n1 : ns)) a -> Mat (n :| (n1 : ns)) a
+ Cybus.Mat: swapCol :: forall (i :: Nat) (j :: Nat) (n :: Nat) (n1 :: Nat) ns a. (FinT i n1, FinT j n1) => Mat (n : (n1 : ns)) a -> Mat (n : (n1 : ns)) a
- Cybus.Mat: swapCol' :: forall (n :: Nat) (n1 :: Nat) ns a. Fin n1 -> Fin n1 -> Mat (n :| (n1 : ns)) a -> Mat (n :| (n1 : ns)) a
+ Cybus.Mat: swapCol' :: forall (n :: Nat) (n1 :: Nat) ns a. Fin n1 -> Fin n1 -> Mat (n : (n1 : ns)) a -> Mat (n : (n1 : ns)) a
- Cybus.Mat: swapMat :: forall (is :: NonEmpty Nat) (js :: NonEmpty Nat) ns a. (FinMatC is ns, FinMatC js ns) => Mat ns a -> Mat ns a
+ Cybus.Mat: swapMat :: forall (is :: [Nat]) (js :: [Nat]) ns a. (FinMatC is ns, FinMatC js ns) => Mat ns a -> Mat ns a
- Cybus.Mat: swapRow :: forall (i :: Nat) (j :: Nat) (n :: Nat) ns a. (FinT i n, FinT j n) => Mat (n :| ns) a -> Mat (n :| ns) a
+ Cybus.Mat: swapRow :: forall (i :: Nat) (j :: Nat) (n :: Nat) ns a. (FinT i n, FinT j n) => Mat (n : ns) a -> Mat (n : ns) a
- Cybus.Mat: swapRow' :: forall (n :: Nat) ns a. Fin n -> Fin n -> Mat (n :| ns) a -> Mat (n :| ns) a
+ Cybus.Mat: swapRow' :: forall (n :: Nat) ns a. Fin n -> Fin n -> Mat (n : ns) a -> Mat (n : ns) a
- Cybus.Mat: toLeaves :: LeafC ns => Mat ns a -> Mat (Init1T ns) (Vec (Last1T ns) a)
+ Cybus.Mat: toLeaves :: LeafC ns => Mat ns a -> Mat (InitT ns) (Vec (LastT ns) a)
- Cybus.Mat: transposeMat :: forall n m ns a. Mat (n :| (m : ns)) a -> Mat (m :| (n : ns)) a
+ Cybus.Mat: transposeMat :: forall n m ns a. Mat (n : (m : ns)) a -> Mat (m : (n : ns)) a
- Cybus.Mat: traverseLeafC :: (LeafC ns, Applicative m) => (FinMat ns -> Vec (Last1T ns) a -> m b) -> Mat ns a -> m (Mat (Init1T ns) b)
+ Cybus.Mat: traverseLeafC :: (LeafC ns, Applicative m) => (FinMat ns -> Vec (LastT ns) a -> m b) -> Mat ns a -> m (Mat (InitT ns) b)
- Cybus.Mat: traverseLeafSimple :: (LeafC ns, Applicative m) => (FinMat ns -> Vec (Last1T ns) a -> m (Vec (Last1T ns) b)) -> Mat ns a -> m (Mat ns b)
+ Cybus.Mat: traverseLeafSimple :: (LeafC ns, Applicative m) => (FinMat ns -> Vec (LastT ns) a -> m (Vec (LastT ns) b)) -> Mat ns a -> m (Mat ns b)
- Cybus.Mat: type Mat2 n m = Mat (n :| '[m])
+ Cybus.Mat: type Mat2 n m = Mat '[n, m]
- Cybus.Mat: type Mat3 n m p = Mat (n :| '[m, p])
+ Cybus.Mat: type Mat3 n m p = Mat '[n, m, p]
- Cybus.Mat: type Mat4 n m p q = Mat (n :| '[m, p, q])
+ Cybus.Mat: type Mat4 n m p q = Mat '[n, m, p, q]
- Cybus.Mat: type Mat5 n m p q r = Mat (n :| '[m, p, q, r])
+ Cybus.Mat: type Mat5 n m p q r = Mat '[n, m, p, q, r]
- Cybus.Mat: type Mat6 n m p q r s = Mat (n :| '[m, p, q, r, s])
+ Cybus.Mat: type Mat6 n m p q r s = Mat '[n, m, p, q, r, s]
- Cybus.Mat: type Vec n = Mat (n :| '[])
+ Cybus.Mat: type Vec n = Mat '[n]
- Cybus.Mat: unrows :: forall n m ns a. Vec n (Mat (m :| ns) a) -> Mat (n :| (m : ns)) a
+ Cybus.Mat: unrows :: forall n m ns a. Vec n (Mat (m : ns) a) -> Mat (n : (m : ns)) a
- Cybus.NatHelper: type D1 a = a :| '[]
+ Cybus.NatHelper: type D1 a = '[a]
- Cybus.NatHelper: type D10 a b c d e f g h i j = a :| '[b, c, d, e, f, g, h, i, j]
+ Cybus.NatHelper: type D10 a b c d e f g h i j = '[a, b, c, d, e, f, g, h, i, j]
- Cybus.NatHelper: type D2 a b = a :| '[b]
+ Cybus.NatHelper: type D2 a b = '[a, b]
- Cybus.NatHelper: type D3 a b c = a :| '[b, c]
+ Cybus.NatHelper: type D3 a b c = '[a, b, c]
- Cybus.NatHelper: type D4 a b c d = a :| '[b, c, d]
+ Cybus.NatHelper: type D4 a b c d = '[a, b, c, d]
- Cybus.NatHelper: type D5 a b c d e = a :| '[b, c, d, e]
+ Cybus.NatHelper: type D5 a b c d e = '[a, b, c, d, e]
- Cybus.NatHelper: type D6 a b c d e f = a :| '[b, c, d, e, f]
+ Cybus.NatHelper: type D6 a b c d e f = '[a, b, c, d, e, f]
- Cybus.NatHelper: type D7 a b c d e f g = a :| '[b, c, d, e, f, g]
+ Cybus.NatHelper: type D7 a b c d e f g = '[a, b, c, d, e, f, g]
- Cybus.NatHelper: type D8 a b c d e f g h = a :| '[b, c, d, e, f, g, h]
+ Cybus.NatHelper: type D8 a b c d e f g h = '[a, b, c, d, e, f, g, h]
- Cybus.NatHelper: type D9 a b c d e f g h i = a :| '[b, c, d, e, f, g, h, i]
+ Cybus.NatHelper: type D9 a b c d e f g h i = '[a, b, c, d, e, f, g, h, i]
- Cybus.NatHelper: type NN n = NS (NN' '[] n)
+ Cybus.NatHelper: type NN n = NN' '[] n

Files

app/Main.hs view
@@ -3,20 +3,20 @@ {-# LANGUAGE TypeApplications #-}  module Main where-import Data.List.NonEmpty (NonEmpty(..))+--import Data.List.NonEmpty (NonEmpty(..)) --import qualified Data.List.NonEmpty as N import Cybus  main :: IO ()-main = putStr $ show $ mm' @212+main = putStr $ show $ mm @(NN 234) -tst1 :: Mat (4 ':| [5,3]) Int+tst1 :: Mat '[4,5,3] Int tst1 = gen id -tst2 :: Mat (4 ':| '[]) (Mat (5 ':| '[3]) Int)-tst2 = toVec (gen @(4 ':| [5,3]) id)+tst2 :: Mat '[4] (Mat '[5,3] Int)+tst2 = toVec (gen @'[4,5,3] id) -tst3 :: Mat (n ':| n1 ': ns) a -> Mat (n ':| '[]) (Mat (n1 ':| ns) a)+tst3 :: Mat (n ': n1 ': ns) a -> Mat '[n] (Mat (n1 ': ns) a) tst3 = toVec  tst4 :: Mat2 4 7 Int@@ -38,5 +38,5 @@   ] ] -it :: Mat (2 ':| '[]) (Mat (3 ':| '[4]) Int)+it :: Mat '[2] (Mat '[3,4] Int) -}
cybus.cabal view
@@ -5,12 +5,12 @@ -- see: https://github.com/sol/hpack  name:           cybus-version:        0.1.0.0+version:        0.2.0.0 synopsis:       multi-dimensional arrays description:    A library for typesafe multi-dimensional arrays . Please see the README on GitHub at <https://github.com/gbwey/cybus#readme> category:       Data, Containers homepage:       https://github.com/gbwey/cybus#readme-bug-reports:    https://github.com/gbwey/cybus.git/issues+bug-reports:    https://github.com/gbwey/cybus/issues author:         Grant Weyburne <gbwey9@gmail.com> maintainer:     Grant Weyburne <gbwey9@gmail.com> copyright:      2022 Grant Weyburne@@ -20,7 +20,7 @@  source-repository head   type: git-  location: https://github.com/gbwey/cybus.git+  location: https://github.com/gbwey/cybus  library   exposed-modules:@@ -41,8 +41,8 @@     , distributive     , indexed-traversable     , mtl-    , pos-    , primus+    , pos >=0.2.0.0+    , primus >=0.2.0.0     , profunctors     , semigroupoids     , these@@ -65,8 +65,8 @@     , distributive     , indexed-traversable     , mtl-    , pos-    , primus+    , pos >=0.2.0.0+    , primus >=0.2.0.0     , profunctors     , semigroupoids     , these@@ -99,9 +99,9 @@     , indexed-traversable     , lens     , mtl-    , pos+    , pos >=0.2.0.0     , pretty-simple-    , primus+    , primus >=0.2.0.0     , profunctors     , semigroupoids     , tasty
src/Cybus.hs view
@@ -14,7 +14,6 @@   module Primus.Bool,   module Primus.Enum,   module Primus.Error,-  module Primus.Extra,   module Primus.Fold,   module Primus.List,   module Primus.NonEmpty,@@ -31,7 +30,6 @@ import Primus.Bool import Primus.Enum import Primus.Error-import Primus.Extra import Primus.Fold import Primus.List import Primus.NonEmpty
src/Cybus/Fin.hs view
@@ -42,8 +42,6 @@   readFin,    -- * constructors--  -- * miscellaneous   mkFinC,   mkFin,   fin,@@ -85,7 +83,6 @@ import GHC.TypeNats (Nat) import Primus.Enum import Primus.Error-import Primus.Extra import Primus.Num1 import qualified Text.ParserCombinators.ReadP as P import qualified Text.ParserCombinators.ReadPrec as PC
src/Cybus/FinMat.hs view
@@ -26,15 +26,21 @@ License     : BSD-3 -} module Cybus.FinMat (+  -- * core type   type FinMat,   fmPos,   fmNS,   pattern FinMat,   pattern FinMatU,++  -- * constructors+  FinMatC (..),   mkFinMat,   mkFinMatC,+  finMat,   toFinMatFromPos,-  FinMatC (..),++  -- * conversions   finMatToNonEmpty,   nonEmptyToFinMat,   nonEmptyToFinMat',@@ -45,17 +51,15 @@   readFinMat,   showFinMat', -  -- * constructors-   -- * miscellaneous-  NSC (..),+  NS (..),   NSRangeC,-  _finMatFin,+  relPos,   finMatFinSet,   finMatFinGet,-  relPos, -  -- * lens into indices of matrix+  -- * lens into the matrix indices+  _finMatFin,   _i1,   _i2,   _i3,@@ -87,16 +91,15 @@ import qualified GHC.TypeNats as GN import Primus.Enum import Primus.Error-import Primus.Extra import Primus.Lens import Primus.NonEmpty import Primus.Num1-import qualified Primus.TypeLevel as TP (Len1T, pnat)+import qualified Primus.TypeLevel as TP (LengthT, pnat) import qualified Text.ParserCombinators.ReadP as P import qualified Text.ParserCombinators.ReadPrec as PC  -- | definition of the indices of a matrix-type FinMat :: NonEmpty Nat -> Type+type FinMat :: [Nat] -> Type data FinMat ns = FinMatUnsafe !Int !(NonEmpty Pos)   deriving stock (Eq, Ord, Generic, Generic1)   deriving anyclass (NFData)@@ -113,7 +116,7 @@ {-# COMPLETE FinMat #-}  pattern FinMat ::-  forall (ns :: NonEmpty Nat).+  forall (ns :: [Nat]).   Int ->   NonEmpty Pos ->   FinMat ns@@ -121,10 +124,10 @@  {-# COMPLETE FinMatU #-} --- | pattern synonym for validating the finmatrix before construction but uses an extra 'NSC' constraint to check "ns"+-- | pattern synonym for validating the finmatrix before construction but uses an extra 'NS' constraint to check "ns" pattern FinMatU ::-  forall (ns :: NonEmpty Nat).-  (HasCallStack, NSC ns) =>+  forall (ns :: [Nat]).+  (HasCallStack, NS ns) =>   Int ->   NonEmpty Pos ->   FinMat ns@@ -143,7 +146,7 @@       | otherwise -> pure (FinMatUnsafe i ps)  -- | create a FinMat value level "i" and "ns" values and validate against expected "ns"-mkFinMatC :: forall ns. NSC ns => Int -> NonEmpty Pos -> Either String (FinMat ns)+mkFinMatC :: forall ns. NS ns => Int -> NonEmpty Pos -> Either String (FinMat ns) mkFinMatC i ps = do   let ns = fromNSP @ns   if ns == ps@@ -151,37 +154,54 @@     else Left $ "mkFinMatC: invalid indices: typelevel " ++ show (fromPositives ns) ++ " /= " ++ show (fromPositives ps)  -- | create a FinMat using a relative type level index-toFinMatFromPos :: forall (i :: Nat) ns. (NSC ns, i <! Product1T ns) => FinMat ns+toFinMatFromPos :: forall (i :: Nat) ns. (NS ns, i <! ProductT ns) => FinMat ns toFinMatFromPos = FinMatU (TP.pnat @i) (fromNSP @ns) +-- | convenience function for conversion from 'Int' to 'FinMat'+finMat :: forall ns. NS ns => Int -> Either String (FinMat ns)+finMat i = mkFinMatC i (fromNSP @ns)+ -- | convert type level indices into a FinMat class FinMatC is ns where   finMatC :: FinMat ns -instance (NSC is, NSC ns, FinMatT is ns 1 is ns) => FinMatC is ns where-  finMatC = frp $ nonEmptyToFinMat' (fromNSP @is) (fromNSP @ns)+instance GL.TypeError ( 'GL.Text "FinMatC '[] '[]: empty index 'is' and 'ns'") => FinMatC '[] '[] where+  finMatC = compileError "FinMatC '[] '[]: finMatC"+instance GL.TypeError ( 'GL.Text "FinMatC '[] (n ': ns): empty index 'is'") => FinMatC '[] (n ': ns) where+  finMatC = compileError "FinMatC '[] (n ': ns): finMatC"+instance GL.TypeError ( 'GL.Text "FinMatC (i ': is) '[]: empty index 'ns'") => FinMatC (i ': is) '[] where+  finMatC = compileError "FinMatC (i ': is) '[]: finMatC" -type FinMatT :: NonEmpty Nat -> NonEmpty Nat -> Nat -> NonEmpty Nat -> NonEmpty Nat -> Constraint+instance (is' ~ (i ': is), ns' ~ (n ': ns), NS is', NS ns', FinMatT is' ns' 1 is' ns') => FinMatC (i ': is) (n ': ns) where+  finMatC = frp $ nonEmptyToFinMat' (fromNSP @is') (fromNSP @ns')++type FinMatT :: [Nat] -> [Nat] -> Nat -> [Nat] -> [Nat] -> Constraint type family FinMatT is0 ns0 ind is ns where-  FinMatT _is0 _ns0 ind (i ':| '[]) (n ':| '[]) =+  FinMatT _is0 _ns0 ind '[] (_ ': _) =+    GL.TypeError ( 'GL.Text "FinMatT: empty index 'is' " 'GL.:<>: 'GL.ShowType ind)+  FinMatT _is0 _ns0 ind (_ ': _) '[] =+    GL.TypeError ( 'GL.Text "FinMatT: empty index 'ns' " 'GL.:<>: 'GL.ShowType ind)+  FinMatT _is0 _ns0 ind '[] '[] =+    GL.TypeError ( 'GL.Text "FinMatT: empty index 'is' and 'ns' " 'GL.:<>: 'GL.ShowType ind)+  FinMatT _is0 _ns0 ind '[i] '[n] =     FinWithMessageT ( 'GL.Text " at index " 'GL.:<>: 'GL.ShowType ind) i n-  FinMatT is0 ns0 ind (i ':| i' ': is) (n ':| n' ': ns) =-    (FinWithMessageT ( 'GL.Text " at index=" 'GL.:<>: 'GL.ShowType ind) i n, FinMatT is0 ns0 (ind GN.+ 1) (i' ':| is) (n' ':| ns))-  FinMatT is0 ns0 _ind (_ ':| _ ': _) (_ ':| '[]) =+  FinMatT is0 ns0 ind (i ': i' ': is) (n ': n' ': ns) =+    (FinWithMessageT ( 'GL.Text " at index=" 'GL.:<>: 'GL.ShowType ind) i n, FinMatT is0 ns0 (ind GN.+ 1) (i' ': is) (n' ': ns))+  FinMatT is0 ns0 _ind (_ ': _ ': _) '[_] =     GL.TypeError       ( 'GL.Text "too many indices: length is > length ns:"           'GL.:<>: 'GL.Text " found "-          'GL.:<>: 'GL.ShowType (TP.Len1T is0)+          'GL.:<>: 'GL.ShowType (TP.LengthT is0)           'GL.:<>: 'GL.Text " expected "-          'GL.:<>: 'GL.ShowType (TP.Len1T ns0)+          'GL.:<>: 'GL.ShowType (TP.LengthT ns0)       )-  FinMatT is0 ns0 _ind (_ ':| '[]) (_ ':| _ ': _) =+  FinMatT is0 ns0 _ind '[_] (_ ': _ ': _) =     GL.TypeError       ( 'GL.Text "not enough indices: length is < length ns: "           'GL.:<>: 'GL.Text " found "-          'GL.:<>: 'GL.ShowType (TP.Len1T is0)+          'GL.:<>: 'GL.ShowType (TP.LengthT is0)           'GL.:<>: 'GL.Text " expected "-          'GL.:<>: 'GL.ShowType (TP.Len1T ns0)+          'GL.:<>: 'GL.ShowType (TP.LengthT ns0)       )  -- | convert a FinMat into a list of indices@@ -189,7 +209,7 @@ finMatToNonEmpty (FinMat i ns) = snd $ L.mapAccumR divModNextP i ns  -- | try to convert a list of indices into a FinMat-nonEmptyToFinMat :: forall ns. NSC ns => NonEmpty Pos -> Either String (FinMat ns)+nonEmptyToFinMat :: forall ns. NS ns => NonEmpty Pos -> Either String (FinMat ns) nonEmptyToFinMat is = nonEmptyToFinMat' is (fromNSP @ns)  -- | try to convert a list of indices into a FinMat@@ -218,13 +238,13 @@         then programmError $ "relPos " ++ show ret         else ret -instance NSC ns => Monoid (FinMat ns) where+instance NS ns => Monoid (FinMat ns) where   mempty = minBound  instance Semigroup (FinMat ns) where   (<>) = max -instance NSC ns => Num (FinMat ns) where+instance NS ns => Num (FinMat ns) where   (+) = forceRight "(+)" .@ withOp2 (+)   (-) = forceRight "(-)" .@ withOp2 (-)   (*) = forceRight "(*)" .@ withOp2 (*)@@ -238,30 +258,30 @@         ii <- integerToIntSafe i         mkFinMatC ii (fromNSP @ns) -instance NSC ns => Num1 (FinMat ns) where+instance NS ns => Num1 (FinMat ns) where   fromInteger1 (FinMat _ ns) i = do     ii <- integerToIntSafe i     mkFinMatC ii ns -instance NSC ns => Enum (FinMat ns) where+instance NS ns => Enum (FinMat ns) where   toEnum = forceRight "Enum(FinMat ns):toEnum" . flip mkFinMatC (fromNSP @ns)   fromEnum = fmPos   enumFrom = boundedEnumFrom   enumFromThen = boundedEnumFromThen -instance NSC ns => Bounded (FinMat ns) where+instance NS ns => Bounded (FinMat ns) where   minBound = FinMatU 0 (fromNSP @ns)   maxBound = FinMatU (unP (fromNSTotalP @ns) - 1) (fromNSP @ns) -instance NSC ns => Read (FinMat ns) where+instance NS ns => Read (FinMat ns) where   readPrec = PC.readP_to_Prec (const readFinMatP)  -- | reader for 'FinMat'-readFinMat :: NSC ns => ReadS (FinMat ns)+readFinMat :: NS ns => ReadS (FinMat ns) readFinMat = P.readP_to_S readFinMatP  -- | reader for 'showFin'-readFinMatP :: forall ns. NSC ns => P.ReadP (FinMat ns)+readFinMatP :: forall ns. NS ns => P.ReadP (FinMat ns) readFinMatP = do   P.skipSpaces   (i, ns) <- (,) <$> pInt <* P.char '@' <*> pPositives '{' '}'@@ -283,19 +303,20 @@ instance Show (FinMat ns) where   show = showFinMat --- | constrain i within the size of the indices ie "i >= 1 && i <= Length ns"-type NSRangeC :: Peano -> NonEmpty Nat -> Constraint+-- | constrain i within the size of the indices ie "i >= 1 && i <= LengthT ns"+type NSRangeC :: Peano -> [Nat] -> Constraint class NSRangeC i ns -instance NSRangeC ( 'S 'Z) (n ':| ns)-instance NSRangeC ( 'S i) (m ':| ns) => NSRangeC ( 'S ( 'S i)) (n ':| m ': ns)+instance GL.TypeError ('GL.Text "NSRangeC '[]: empty indices") => NSRangeC p '[]+instance NSRangeC ( 'S 'Z) (n ': ns)+instance NSRangeC ( 'S i) (m ': ns) => NSRangeC ( 'S ( 'S i)) (n ': m ': ns) instance   GL.TypeError ( 'GL.Text "NSRangeC: index is larger than the number of matrix indices ns") =>-  NSRangeC ( 'S ( 'S i)) (n ':| '[])+  NSRangeC ( 'S ( 'S i)) '[n]  instance   GL.TypeError ( 'GL.Text "NSRangeC: zero is not a valid index: index must be one or greater") =>-  NSRangeC 'Z (n ':| ns)+  NSRangeC 'Z (n ': ns)  -- | a lens for accessing the "i" index in a indices of FinMat _finMatFin ::@@ -335,41 +356,41 @@         (Just p, Just n) -> frp $ mkFin p n  -- | lens for index 1-_i1 :: Lens' (FinMat (n ':| ns)) (Fin n)+_i1 :: Lens' (FinMat (n ': ns)) (Fin n) _i1 = _finMatFin @1  -- | lens for index 2-_i2 :: Lens' (FinMat (n1 ':| n ': ns)) (Fin n)+_i2 :: Lens' (FinMat (n1 ': n ': ns)) (Fin n) _i2 = _finMatFin @2  -- | lens for index 3-_i3 :: Lens' (FinMat (n1 ':| n2 ': n ': ns)) (Fin n)+_i3 :: Lens' (FinMat (n1 ': n2 ': n ': ns)) (Fin n) _i3 = _finMatFin @3  -- | lens for index 4-_i4 :: Lens' (FinMat (n1 ':| n2 ': n3 ': n ': ns)) (Fin n)+_i4 :: Lens' (FinMat (n1 ': n2 ': n3 ': n ': ns)) (Fin n) _i4 = _finMatFin @4  -- | lens for index 5-_i5 :: Lens' (FinMat (n1 ':| n2 ': n3 ': n4 ': n ': ns)) (Fin n)+_i5 :: Lens' (FinMat (n1 ': n2 ': n3 ': n4 ': n ': ns)) (Fin n) _i5 = _finMatFin @5  -- | lens for index 6-_i6 :: Lens' (FinMat (n1 ':| n2 ': n3 ': n4 ': n5 ': n ': ns)) (Fin n)+_i6 :: Lens' (FinMat (n1 ': n2 ': n3 ': n4 ': n5 ': n ': ns)) (Fin n) _i6 = _finMatFin @6  -- | lens for index 7-_i7 :: Lens' (FinMat (n1 ':| n2 ': n3 ': n4 ': n5 ': n6 ': n ': ns)) (Fin n)+_i7 :: Lens' (FinMat (n1 ': n2 ': n3 ': n4 ': n5 ': n6 ': n ': ns)) (Fin n) _i7 = _finMatFin @7  -- | lens for index 8-_i8 :: Lens' (FinMat (n1 ':| n2 ': n3 ': n4 ': n5 ': n6 ': n7 ': n ': ns)) (Fin n)+_i8 :: Lens' (FinMat (n1 ': n2 ': n3 ': n4 ': n5 ': n6 ': n7 ': n ': ns)) (Fin n) _i8 = _finMatFin @8  -- | lens for index 9-_i9 :: Lens' (FinMat (n1 ':| n2 ': n3 ': n4 ': n5 ': n6 ': n7 ': n8 ': n ': ns)) (Fin n)+_i9 :: Lens' (FinMat (n1 ': n2 ': n3 ': n4 ': n5 ': n6 ': n7 ': n8 ': n ': ns)) (Fin n) _i9 = _finMatFin @9  -- | lens for index 10-_i10 :: Lens' (FinMat (n1 ':| n2 ': n3 ': n4 ': n5 ': n6 ': n7 ': n8 ': n9 ': n ': ns)) (Fin n)+_i10 :: Lens' (FinMat (n1 ': n2 ': n3 ': n4 ': n5 ': n6 ': n7 ': n8 ': n9 ': n ': ns)) (Fin n) _i10 = _finMatFin @10
src/Cybus/Mat.hs view
@@ -1,4 +1,3 @@- {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-}@@ -70,7 +69,6 @@   mat2',   gen',   gen,-  mm',   mm,   buildMat, @@ -297,19 +295,18 @@ import qualified GHC.TypeNats as GN import Primus.Enum import Primus.Error-import Primus.Extra import Primus.Fold import Primus.Lens import Primus.NonEmpty import Primus.Num1 import Primus.One import Primus.Rep-import qualified Primus.TypeLevel as TP (Cons1T, Init1T, Last1T, type (++))+import qualified Primus.TypeLevel as TP import qualified Text.ParserCombinators.ReadP as P import qualified Text.ParserCombinators.ReadPrec as PC  -- | definition of a matrix-type Mat :: NonEmpty Nat -> Type -> Type+type Mat :: [Nat] -> Type -> Type data Mat ns a = MatUnsafe !(Vector a) !(NonEmpty Pos)   deriving stock (Functor, Traversable, Foldable, Generic, Generic1, Eq, Ord)   deriving anyclass (NFData, NFData1)@@ -324,27 +321,27 @@  -- | convenient type synonym for a 1d matrix type Vec :: Nat -> Type -> Type-type Vec n = Mat (n ':| '[])+type Vec n = Mat '[n]  -- | convenient type synonym for a 2d matrix type Mat2 :: Nat -> Nat -> Type -> Type-type Mat2 n m = Mat (n ':| '[m])+type Mat2 n m = Mat '[n, m]  -- | convenient type synonym for a 3d matrix type Mat3 :: Nat -> Nat -> Nat -> Type -> Type-type Mat3 n m p = Mat (n ':| '[m, p])+type Mat3 n m p = Mat '[n, m, p]  -- | convenient type synonym for a 4d matrix type Mat4 :: Nat -> Nat -> Nat -> Nat -> Type -> Type-type Mat4 n m p q = Mat (n ':| '[m, p, q])+type Mat4 n m p q = Mat '[n, m, p, q]  -- | convenient type synonym for a 5d matrix type Mat5 :: Nat -> Nat -> Nat -> Nat -> Nat -> Type -> Type-type Mat5 n m p q r = Mat (n ':| '[m, p, q, r])+type Mat5 n m p q r = Mat '[n, m, p, q, r]  -- | convenient type synonym for a 6d matrix type Mat6 :: Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Type -> Type-type Mat6 n m p q r s = Mat (n ':| '[m, p, q, r, s])+type Mat6 n m p q r s = Mat '[n, m, p, q, r, s]  -- | convenient type synonym for specifying the dimensions of a matrix using the 'NN' type family type MatN :: Nat -> Type -> Type@@ -354,7 +351,7 @@ {-# COMPLETE Mat #-}  pattern Mat ::-  forall (ns :: NonEmpty Nat) a.+  forall (ns :: [Nat]) a.   Vector a ->   NonEmpty Pos ->   Mat ns a@@ -364,7 +361,7 @@  -- | bidirectional pattern synonym for simple validation of a matrix before construction pattern MatIU ::-  forall (ns :: NonEmpty Nat) a.+  forall (ns :: [Nat]) a.   HasCallStack =>   Vector a ->   NonEmpty Pos ->@@ -376,10 +373,10 @@  {-# COMPLETE MatU #-} --- | bidirectional pattern synonym for validating a matrix before construction with 'NSC' constraint for additional typelevel validation+-- | bidirectional pattern synonym for validating a matrix before construction with 'NS' constraint for additional typelevel validation pattern MatU ::-  forall (ns :: NonEmpty Nat) a.-  (NSC ns, HasCallStack) =>+  forall (ns :: [Nat]) a.+  (NS ns, HasCallStack) =>   Vector a ->   NonEmpty Pos ->   Mat ns a@@ -392,25 +389,25 @@   fromInteger1 = toEnumTraversable   toInteger1 = fromEnumFoldable1 -- need this as Enum is only Int but containers can be larger ie Integer -instance (Enum a, Bounded a, NSC ns) => Enum (Mat ns a) where+instance (Enum a, Bounded a, NS ns) => Enum (Mat ns a) where   toEnum = forceRight "Enum Mat:toEnum" . toEnumRep . toInteger   fromEnum = forceRight "Enum Mat:fromEnum" . integerToIntSafe . fromEnumFoldable1   enumFrom = boundedEnumFrom   enumFromThen = boundedEnumFromThen -instance (NSC ns, Bounded a) => Bounded (Mat ns a) where+instance (NS ns, Bounded a) => Bounded (Mat ns a) where   minBound = pure minBound   maxBound = pure maxBound -instance (c ~ Char, NSC ns) => IsString (Mat ns c) where+instance (c ~ Char, NS ns) => IsString (Mat ns c) where   fromString = mat  -- | generate a 'Mat' using a list-mat, mat' :: forall ns a. (HasCallStack, NSC ns) => [a] -> Mat ns a+mat, mat' :: forall ns a. (HasCallStack, NS ns) => [a] -> Mat ns a mat = fr . matImpl False mat' = fr . matImpl True -matImpl :: forall ns a. NSC ns => Bool -> [a] -> Either String (Mat ns a)+matImpl :: forall ns a. NS ns => Bool -> [a] -> Either String (Mat ns a) matImpl b = \case   [] -> Left "matImpl: no data"   x : xs -> do@@ -422,18 +419,18 @@       _o -> Right $ MatU (V.fromListN (unP n) (N.toList as)) ns  -- | used by 'pure' so dont call pure from here-pureMat :: forall ns a. NSC ns => a -> Mat ns a+pureMat :: forall ns a. NS ns => a -> Mat ns a pureMat a =   let ns = fromNSP @ns    in MatU (V.replicate (productPInt ns) a) ns  -- | creates a matrix of first dimension "n" by replicating the input matrix "n" times-replicateMat :: forall n n1 ns a. PosT n => Mat (n1 ':| ns) a -> Mat (n ':| n1 ': ns) a+replicateMat :: forall n n1 ns a. PosT n => Mat (n1 ': ns) a -> Mat (n ': n1 ': ns) a replicateMat (Mat v ns) =   let n = fromNP @n    in MatIU (V.concat (replicate (unP n) v)) (n N.<| ns) -instance (NSC ns, Num a) => Num (Mat ns a) where+instance (NS ns, Num a) => Num (Mat ns a) where   (+) = liftA2 (+)   (-) = liftA2 (-)   (*) = liftA2 (*)@@ -442,31 +439,31 @@   fromInteger = pure . fromInteger   abs = fmap abs -instance (NSC ns, Fractional a) => Fractional (Mat ns a) where+instance (NS ns, Fractional a) => Fractional (Mat ns a) where   (/) = liftA2 (/)   recip = fmap recip   fromRational = pure . fromRational -instance NSC ns => Applicative (Mat ns) where+instance NS ns => Applicative (Mat ns) where   pure = pureMat   (<*>) = ap2  ap2 :: Mat ns (a -> b) -> Mat ns a -> Mat ns b ap2 (Mat vab ps) (Mat va _) = MatIU (V.zipWith id vab va) ps -- ziplist style -ap3 :: NSC ns => (a -> Mat ns b) -> Mat ns a -> Mat ns b+ap3 :: NS ns => (a -> Mat ns b) -> Mat ns a -> Mat ns b ap3 f = imap (\fn -> indexMat fn . f)  instance Apply.Apply (Mat ns) where   (<.>) = ap2 -instance NSC ns => Monad (Mat ns) where+instance NS ns => Monad (Mat ns) where   (>>=) = flip ap3 -instance NSC ns => Bind.Bind (Mat ns) where+instance NS ns => Bind.Bind (Mat ns) where   (>>-) = flip ap3 -instance NSC ns => MonadZip (Mat ns) where+instance NS ns => MonadZip (Mat ns) where   mzipWith = zipWithMat  -- | zip two matrices using a combining function@@ -481,7 +478,7 @@ zipMat :: Mat ns a -> Mat ns b -> Mat ns (a, b) zipMat = zipWithMat (,) --- | 'zipWithMat' with an Applicative or use 'Primus.Fold.zipWithT' but that needs a 'NSC' constraint+-- | 'zipWithMat' with an Applicative or use 'Primus.Fold.zipWithT' but that needs a 'NS' constraint zipWithMatA ::   Applicative f =>   (a -> b -> f c) ->@@ -492,7 +489,7 @@  -- | 'zipWithMat' with an index or use 'Primus.Rep.izipWithR' izipWith ::-  NSC ns =>+  NS ns =>   (FinMat ns -> a -> b -> c) ->   Mat ns a ->   Mat ns b ->@@ -501,7 +498,7 @@  -- | 'zipWithMatA' with an index or use 'Primus.Rep.izipWithR' if "f" is 'Data.Distributive.Distributive' izipWithM ::-  (NSC ns, Applicative f) =>+  (NS ns, Applicative f) =>   (FinMat ns -> a -> b -> f c) ->   Mat ns a ->   Mat ns b ->@@ -519,20 +516,20 @@  instance Semigroup a => Semigroup (Mat ns a) where   (<>) = zipWithMat (<>)-instance (Monoid a, NSC ns) => Monoid (Mat ns a) where+instance (Monoid a, NS ns) => Monoid (Mat ns a) where   mempty = pure mempty -instance NSC ns => FunctorWithIndex (FinMat ns) (Mat ns) where+instance NS ns => FunctorWithIndex (FinMat ns) (Mat ns) where   imap f = snd . L.mapAccumL (\i a -> (i + 1, f (FinMatU i (fromNSP @ns)) a)) 0 -instance NSC ns => FoldableWithIndex (FinMat ns) (Mat ns) where+instance NS ns => FoldableWithIndex (FinMat ns) (Mat ns) where   ifoldMap f = fold . imap f  -- todo: write a dedicated version-instance NSC ns => TraversableWithIndex (FinMat ns) (Mat ns) where+instance NS ns => TraversableWithIndex (FinMat ns) (Mat ns) where   itraverse f = sequenceA . imap f -instance NSC ns => Distributive (Mat ns) where+instance NS ns => Distributive (Mat ns) where   collect agb fa =     let z = agb <$> fa      in imap (\fm -> const ((V.! fmPos fm) . mVec <$> z)) (pure ())@@ -542,19 +539,19 @@ indexMat fm = (V.! fmPos fm) . mVec  -- | create a matrix of matrix indices for a given size "ns"-finMatMatrix :: forall ns. NSC ns => Mat ns (FinMat ns)+finMatMatrix :: forall ns. NS ns => Mat ns (FinMat ns) finMatMatrix = finMatMatrix' (pure ())  -- | fill an existing matrix with indices-finMatMatrix' :: forall ns x. NSC ns => Mat ns x -> Mat ns (FinMat ns)+finMatMatrix' :: forall ns x. NS ns => Mat ns x -> Mat ns (FinMat ns) finMatMatrix' = imap const -instance NSC ns => Representable (Mat ns) where+instance NS ns => Representable (Mat ns) where   type Rep (Mat ns) = FinMat ns   tabulate f = imap (const . f) (pure ())   index = flip indexMat -instance NSC ns => GE.IsList (Mat ns a) where+instance NS ns => GE.IsList (Mat ns a) where   type Item (Mat ns a) = a   fromList = snd . fr . fillTraversable (pure ())   toList = toListMat@@ -569,29 +566,33 @@         then Right (MatUnsafe v ps)         else Left $ "\n\nproduct of " ++ show (fromPositives ps) ++ "=" ++ show n1 ++ "\nvector length=" ++ show n2 ++ "\n" --- | validate before creating a matrix with extra 'NSC' constraint to check that "ns" and 'mIndices' match-mkMatC :: forall ns a. NSC ns => Vector a -> NonEmpty Pos -> Either String (Mat ns a)+-- | validate before creating a matrix with extra 'NS' constraint to check that "ns" and 'mIndices' match+mkMatC :: forall ns a. NS ns => Vector a -> NonEmpty Pos -> Either String (Mat ns a) mkMatC v ps = do   let ps1 = fromNSP @ns   if ps == ps1     then mkMat v ps     else Left $ "\nns mismatch: expected: " ++ show (fromPositives ps1) ++ " but found " ++ show (fromPositives ps) --- | generate a matrix using indices-gen' :: forall ns a. NSC ns => ([Int] -> a) -> Mat ns a+-- | generate a matrix passing the indices at that element to a user callback function+gen' :: forall ns a. NS ns => ([Int] -> a) -> Mat ns a gen' f = tabulate (f . fromPositives . finMatToNonEmpty @ns) --- | generate a matrix using relative position-gen :: forall ns a. NSC ns => (Int -> a) -> Mat ns a+-- | generate a matrix passing a relative position of the element to a user callback function+gen :: forall ns a. NS ns => (Int -> a) -> Mat ns a gen f = tabulate (f . fmPos) +-- | generate a matrix using relative position starting at one+mm :: forall ns. NS ns => Mat ns Int+mm = gen (+ 1)+ -- | lens that accesses a value inside a mat given a concrete mat index-ixMat :: forall (ns :: NonEmpty Nat) a. FinMat ns -> Lens' (Mat ns a) a+ixMat :: forall (ns :: [Nat]) a. FinMat ns -> Lens' (Mat ns a) a ixMat i = lens (indexMat i) (\s b -> setMat b i s)  -- | lens that accesses a value inside a mat using a type level index ixMat' ::-  forall (is :: NonEmpty Nat) (ns :: NonEmpty Nat) a.+  forall (is :: [Nat]) (ns :: [Nat]) a.   FinMatC is ns =>   Lens' (Mat ns a) a ixMat' = ixMat (finMatC @is @ns)@@ -615,7 +616,7 @@ infixr 4 .:  -- | cons a matrix with a one-higher dimension matrix-(.::) :: forall n m ns a. Mat (m ':| ns) a -> Mat (n ':| m ': ns) a -> Mat (1 GN.+ n ':| m ': ns) a+(.::) :: forall n m ns a. Mat (m ': ns) a -> Mat (n ': m ': ns) a -> Mat (1 GN.+ n ': m ': ns) a Mat v (_ :| _) .:: Mat v1 (p1 :| ps1) = MatIU (v <> v1) (succP p1 :| ps1)  infixr 3 .::@@ -627,7 +628,7 @@ infixr 4 .|  -- | combine two matrices-(.||) :: forall m ns a. Mat (m ':| ns) a -> Mat (m ':| ns) a -> Mat (2 ':| m ': ns) a+(.||) :: forall m ns a. Mat (m ': ns) a -> Mat (m ': ns) a -> Mat (2 ': m ': ns) a Mat v (_ :| _) .|| Mat v1 (p1 :| ps1) = MatIU (v <> v1) (_2P :| p1 : ps1)  infixr 3 .||@@ -637,46 +638,46 @@ se1 a = MatU (V.singleton a) (_1P :| [])  -- | last element in a 2d or greater matrix-se2 :: forall n ns a. Mat (n ':| ns) a -> Mat (1 ':| n ': ns) a+se2 :: forall n ns a. Mat (n ': ns) a -> Mat (1 ': n ': ns) a se2 (Mat v ps) = MatIU v (_1P N.<| ps)  -- | create a 1d matrix from a list of values vec :: forall n a. (HasCallStack, PosT n) => [a] -> Vec n a-vec = mat @(n ':| '[])+vec = mat @'[n]  -- | create a 1d matrix from a list of values with the exact number of elements vec' :: forall n a. (HasCallStack, PosT n) => [a] -> Vec n a-vec' = mat' @(n ':| '[])+vec' = mat' @'[n]  -- | create a 2d matrix from a list of values mat2 :: forall n m a. (HasCallStack, PosT n, PosT m) => [a] -> Mat2 n m a-mat2 = mat @(n ':| m ': '[])+mat2 = mat @'[n, m]  -- | create a 2d matrix from a list of values with the exact number of elements mat2' :: forall n m a. (HasCallStack, PosT n, PosT m) => [a] -> Mat2 n m a-mat2' = mat' @(n ':| m ': '[])+mat2' = mat' @'[n, m]  -- | map each column mapCols ::   forall n m ns a b.-  (FinMat (m ':| n ': ns) -> Vec (TP.Last1T (n ':| ns)) a -> Vec (TP.Last1T (n ':| ns)) b) ->-  Mat (n ':| m ': ns) a ->-  Mat (n ':| m ': ns) b+  (FinMat (m ': n ': ns) -> Vec (TP.LastT (n ': ns)) a -> Vec (TP.LastT (n ': ns)) b) ->+  Mat (n ': m ': ns) a ->+  Mat (n ': m ': ns) b mapCols f = transposeMat . mapLeafSimple f . transposeMat  -- | map each column with user state mapCols' ::   forall n m ns a b c.-  (FinMat (m ':| n ': ns) -> c -> Vec (TP.Last1T (n ':| ns)) a -> (c, Vec (TP.Last1T (n ':| ns)) b)) ->+  (FinMat (m ': n ': ns) -> c -> Vec (TP.LastT (n ': ns)) a -> (c, Vec (TP.LastT (n ': ns)) b)) ->   c ->-  Mat (n ':| m ': ns) a ->-  (c, Mat (n ':| m ': ns) b)+  Mat (n ': m ': ns) a ->+  (c, Mat (n ': m ': ns) b) mapCols' f c = fmap transposeMat . mapLeafSimpleS f c . transposeMat  -- | traverse over a nested leaf matrix only allowing changes to "a" traverseLeafSimple ::   (LeafC ns, Applicative m) =>-  (FinMat ns -> Vec (TP.Last1T ns) a -> m (Vec (TP.Last1T ns) b)) ->+  (FinMat ns -> Vec (TP.LastT ns) a -> m (Vec (TP.LastT ns) b)) ->   Mat ns a ->   m (Mat ns b) traverseLeafSimple f = fmap fromLeavesInternalC . traverseLeafC f@@ -684,7 +685,7 @@ -- | map over a nested leaf matrix only allowing changes to "a" mapLeafSimple ::   LeafC ns =>-  (FinMat ns -> Vec (TP.Last1T ns) a -> Vec (TP.Last1T ns) b) ->+  (FinMat ns -> Vec (TP.LastT ns) a -> Vec (TP.LastT ns) b) ->   Mat ns a ->   Mat ns b mapLeafSimple f = fromLeavesInternalC . runIdentity . traverseLeafC (Identity .@ f)@@ -693,7 +694,7 @@ foldMapLeaf   , foldMapLeafR ::     (Monoid z, LeafC ns) =>-    (FinMat ns -> Vec (TP.Last1T ns) a -> z) ->+    (FinMat ns -> Vec (TP.LastT ns) a -> z) ->     Mat ns a ->     z foldMapLeaf f = getConst . traverseLeafC (Const .@ f)@@ -702,24 +703,24 @@ -- | map over a nested leaf matrix mapLeaf ::   LeafC ns =>-  (FinMat ns -> Vec (TP.Last1T ns) a -> b) ->+  (FinMat ns -> Vec (TP.LastT ns) a -> b) ->   Mat ns a ->-  Mat (TP.Init1T ns) b+  Mat (TP.InitT ns) b mapLeaf f = runIdentity . traverseLeafC (Identity .@ f)  -- | map over a nested leaf matrix with state mapLeafS ::   LeafC ns =>-  (FinMat ns -> c -> Vec (TP.Last1T ns) a -> (c, b)) ->+  (FinMat ns -> c -> Vec (TP.LastT ns) a -> (c, b)) ->   c ->   Mat ns a ->-  (c, Mat (TP.Init1T ns) b)+  (c, Mat (TP.InitT ns) b) mapLeafS f c0 = swap . flip S.runState c0 . traverseLeafC (\i a -> S.state $ \c -> swap (f i c a))  -- | map over a nested leaf matrix only allowing changes to "a" and access to user state mapLeafSimpleS ::   LeafC ns =>-  (FinMat ns -> c -> Vec (TP.Last1T ns) a -> (c, Vec (TP.Last1T ns) b)) ->+  (FinMat ns -> c -> Vec (TP.LastT ns) a -> (c, Vec (TP.LastT ns) b)) ->   c ->   Mat ns a ->   (c, Mat ns b)@@ -729,7 +730,7 @@ -- | fold over a nested leaf matrix foldLeaf ::   LeafC ns =>-  (FinMat ns -> c -> Vec (TP.Last1T ns) a -> c) ->+  (FinMat ns -> c -> Vec (TP.LastT ns) a -> c) ->   c ->   Mat ns a ->   c@@ -741,28 +742,35 @@ toLeaves ::   LeafC ns =>   Mat ns a ->-  Mat (TP.Init1T ns) (Vec (TP.Last1T ns) a)+  Mat (TP.InitT ns) (Vec (TP.LastT ns) a) toLeaves = mapLeaf (const id)  -- | methods for accessing all the leaf rows of a matrix: restricted to 2d hence this class class LeafC ns where   traverseLeafC ::     Applicative m =>-    (FinMat ns -> Vec (TP.Last1T ns) a -> m b) ->+    (FinMat ns -> Vec (TP.LastT ns) a -> m b) ->     Mat ns a ->-    m (Mat (TP.Init1T ns) b)+    m (Mat (TP.InitT ns) b)   fromLeavesInternalC ::-    Mat (TP.Init1T ns) (Vec (TP.Last1T ns) a) ->+    Mat (TP.InitT ns) (Vec (TP.LastT ns) a) ->     Mat ns a  instance+  GL.TypeError ( 'GL.Text "LeafC '[]: rows for empty indices are not supported") =>+  LeafC '[]+  where+  traverseLeafC = compileError "LeafC:traverseLeafC"+  fromLeavesInternalC = compileError "LeafC:fromLeavesInternalC"++instance   GL.TypeError ( 'GL.Text "LeafC: rows for 1D are not supported") =>-  LeafC (n ':| '[])+  LeafC '[n]   where   traverseLeafC = compileError "LeafC:traverseLeafC"   fromLeavesInternalC = compileError "LeafC:fromLeavesInternalC" -instance LeafC (n ':| m ': ns) where+instance LeafC (n ': m ': ns) where   traverseLeafC f w@(Mat _ (n :| ps)) =     case ps of       m : ns ->@@ -777,7 +785,7 @@   fromLeavesInternalC = coerce . concatMat  -- | get the start index for each row in a mat-finMatRows :: forall ns. NSC ns => NonEmpty (FinMat ns)+finMatRows :: forall ns. NS ns => NonEmpty (FinMat ns) finMatRows =   let (xs, _) = unsnoc1 (fromNSP @ns)       ns = appendL1 xs (_1P :| [])@@ -797,30 +805,33 @@ wrapRows1 f = traverseLeafSimple (const (wrap1 f))  -- | reverse the dimensions of a matrix-reverseDim :: Mat ns a -> Mat (Reverse1T ns) a+reverseDim :: Mat ns a -> Mat (ReverseT ns) a reverseDim (Mat v ps) = MatIU v (N.reverse ps)  -- | resize a mat-redim :: forall ms ns a. (NSC ms, Product1T ns ~ Product1T ms) => Mat ns a -> Mat ms a+redim :: forall ms ns a. (NS ms, ProductT ns ~ ProductT ms) => Mat ns a -> Mat ms a redim (Mat v _) = MatU v (fromNSP @ms)  {- | describes the resulting type of taking a slice from the mat  but the indices must match pointwise unlike SliceT so we can use the concrete FinMat to specify the indices -}-type SliceT' :: NonEmpty Nat -> NonEmpty Nat -> Type -> Type+type SliceT' :: [Nat] -> [Nat] -> Type -> Type type family SliceT' ns' ns a where-  SliceT' (n ':| '[]) (n ':| '[]) a = a-  SliceT' (_ ':| n' ': ns') (_ ':| '[]) _ =+  SliceT' '[] (_ ': _) _ = GL.TypeError ( 'GL.Text "SliceT' '[] (_ ': _): not defined for empty indices ns'")+  SliceT' (_ ': _) '[] _ = GL.TypeError ( 'GL.Text "SliceT' (_ ': _) '[]: not defined for empty indices ns")+  SliceT' '[] '[] _ = GL.TypeError ( 'GL.Text "SliceT' '[] '[]: not defined for empty indices ns and ns'")+  SliceT' '[n] '[n] a = a+  SliceT' (_ ': n' ': ns') '[_] _ =     GL.TypeError       ( 'GL.Text "SliceT': there are more ns' indices (lhs) than the actual matrix ns indices (rhs):"           'GL.:<>: 'GL.Text " extra ns'="           'GL.:<>: 'GL.ShowType (n' ': ns')       )-  SliceT' (n ':| '[]) (n ':| n1 ': ns) a = Mat (n1 ':| ns) a-  SliceT' (n ':| n1' ': ns') (n ':| n1 ': ns) a = SliceT' (n1' ':| ns') (n1 ':| ns) a+  SliceT' '[n] (n ': n1 ': ns) a = Mat (n1 ': ns) a+  SliceT' (n ': n1' ': ns') (n ': n1 ': ns) a = SliceT' (n1' ': ns') (n1 ': ns) a -- todo: this condition doesnt fire in SliceC'--- sliceC' (finMatC @(NN 11) @(NN 29)) (mm @235)-  SliceT' (n' ':| _) (n ':| _) _ =+-- sliceC' (finMatC @(NN 11) @(NN 29)) (mm @(NN 235))+  SliceT' (n' ': _) (n ': _) _ =     GL.TypeError       ( 'GL.Text "SliceT': indices need to match pointwise:"           'GL.:<>: 'GL.Text "ie n' /= n:"@@ -832,14 +843,24 @@ {- | allows viewing and updating a slice of a mat using concrete indices  inference is better with n ~ n' but since we have committed to a instance  we are missing nice errors when the indices dont match: eg- sliceC' @(NS '[1]) @(NS '[7]) (FinMat 0 (_7P :| [])) (mm @7)+ sliceC' @'[1] @'[7] (FinMat 0 (_7P :| [])) (mm @(NN 7)) -}-type SliceC' :: NonEmpty Nat -> NonEmpty Nat -> Constraint+type SliceC' :: [Nat] -> [Nat] -> Constraint class SliceC' ns' ns where   sliceC' :: FinMat ns' -> Mat ns a -> SliceT' ns' ns a   sliceUpdateC' :: FinMat ns' -> Mat ns a -> SliceT' ns' ns a -> Mat ns a -instance n ~ n' => SliceC' (n' ':| '[]) (n ':| '[]) where+instance GL.TypeError ( 'GL.Text "SliceC' '[] (n ': ns): empty indices ns'") => SliceC' '[] (n ': ns) where+  sliceC' = compileError "sliceC'"+  sliceUpdateC' = compileError "sliceUpdateC'"+instance GL.TypeError ( 'GL.Text "SliceC' (n' ': ns') '[]: empty indices ns") => SliceC' (n' ': ns') '[] where+  sliceC' = compileError "sliceC'"+  sliceUpdateC' = compileError "sliceUpdateC'"+instance GL.TypeError ( 'GL.Text "SliceC' '[] '[]: empty indices ns and ns'") => SliceC' '[] '[] where+  sliceC' = compileError "sliceC'"+  sliceUpdateC' = compileError "sliceUpdateC'"++instance n ~ n' => SliceC' '[n'] '[n] where   sliceC' (FinMat i _) (Mat v _) =     case v V.!? i of       Nothing -> programmError $ "sliceC': index " ++ show i ++ " out of bounds"@@ -849,7 +870,7 @@      in case V.uncons v2 of           Just (_, v3) -> MatIU (v1 <> V.cons b v3) ps           Nothing -> programmError $ "sliceUpdateC': index " ++ show i ++ " out of bounds"-instance n ~ n' => SliceC' (n' ':| '[]) (n ':| m ': ns) where+instance n ~ n' => SliceC' '[n'] (n ': m ': ns) where   sliceC' (FinMat i _) (Mat v (_ :| ps)) =     case ps of       m : ns ->@@ -866,8 +887,8 @@      in MatIU (v1 <> mVec b <> v2) w  instance-  (n ~ n', SliceC' (n1' ':| ns') (n1 ':| ns)) =>-  SliceC' (n ':| n1' ': ns') (n' ':| n1 ': ns)+  (n ~ n', SliceC' (n1' ': ns') (n1 ': ns)) =>+  SliceC' (n ': n1' ': ns') (n' ': n1 ': ns)   where   sliceC' fm@(FinMat _ (_ :| n1ns')) w@(Mat _ (n :| _)) =     let x :| xs = finMatToNonEmpty fm@@ -875,7 +896,7 @@      in case (xs, n1ns') of           (x1 : x1s, n1 : ns') ->             let fn1 = frp $ nonEmptyToFinMat' (x1 :| x1s) (n1 :| ns')-             in sliceC' @(n1' ':| ns') @(n1 ':| ns) fn1 (sliceC' @(n' ':| '[]) @(n ':| n1 ': ns) (frp $ mkFinMat i (n :| [])) w)+             in sliceC' @(n1' ': ns') @(n1 ': ns) fn1 (sliceC' @'[n'] @(n ': n1 ': ns) (frp $ mkFinMat i (n :| [])) w)           ([], _) -> programmError "sliceC': missing ns' indices"           (_, []) -> programmError "sliceC': missing ns indices"   sliceUpdateC' fm@(FinMat _ (_ :| n1ns')) (Mat v w@(_ :| ps0)) b =@@ -890,33 +911,39 @@                 v1 = V.slice 0 ((i - 1) * len) v                 v2 = V.slice (i * len) (productPInt w - i * len) v                 m1 = MatIU (V.slice ((i - 1) * len) len v) ps1-                mx = sliceUpdateC' @(n1' ':| ns') @(n1 ':| ns) fn1 m1 b+                mx = sliceUpdateC' @(n1' ': ns') @(n1 ': ns) fn1 m1 b              in MatIU (v1 <> mVec mx <> v2) w           ([], _, _) -> programmError "sliceUpdateC': missing matrix indices"           (_, [], _) -> programmError "sliceUpdateC': missing ns' indices"           (_, _, []) -> programmError "sliceUpdateC': missing finmat indices" -instance (GL.TypeError ( 'GL.Text "too many indices ns': length ns' > length ns")) => SliceC' (n' ':| n1' ': ns') (n ':| '[]) where-  sliceC' = compileError "sliceC"-  sliceUpdateC' = compileError "sliceUpdateC"+instance (GL.TypeError ( 'GL.Text "SliceC': too many indices ns': length ns' > length ns")) => SliceC' (n' ': n1' ': ns') '[n] where+  sliceC' = compileError "sliceC'"+  sliceUpdateC' = compileError "sliceUpdateC'"  -- | describes the resulting type of taking a slice from the matrix-type SliceToFinMatT :: NonEmpty Nat -> NonEmpty Nat -> NonEmpty Nat+type SliceToFinMatT :: [Nat] -> [Nat] -> [Nat] type family SliceToFinMatT is ns where-  SliceToFinMatT (_ ':| '[]) (n ':| '[]) = n ':| '[]-  SliceToFinMatT (_ ':| i ': is) (_ ':| '[]) =+  SliceToFinMatT (_ ': _) '[] =+    GL.TypeError ( 'GL.Text "SliceToFinMatT (_ ': _) '[]: 'is' is empty")+  SliceToFinMatT '[] (_ ': _) =+    GL.TypeError ( 'GL.Text "SliceToFinMatT '[] (_ ': _): 'ns' is empty")+  SliceToFinMatT '[] '[] =+    GL.TypeError ( 'GL.Text "SliceToFinMatT '[] '[]: 'is' and 'ns' are empty")+  SliceToFinMatT '[_] '[n] = '[n]+  SliceToFinMatT (_ ': i ': is) '[_] =     GL.TypeError       ( 'GL.Text "SliceToFinMatT: 'is' is larger in length than 'ns':"           'GL.:<>: 'GL.Text " extra 'is'="           'GL.:<>: 'GL.ShowType (i ': is)       )-  SliceToFinMatT (_ ':| '[]) (n ':| _ ': _) = n ':| '[]-  SliceToFinMatT (_ ':| i1 ': is) (n ':| n1 ': ns) = TP.Cons1T n (SliceToFinMatT (i1 ':| is) (n1 ':| ns))+  SliceToFinMatT '[_] (n ': _ ': _) = '[n]+  SliceToFinMatT (_ ': i1 ': is) (n ': n1 ': ns) = n ': SliceToFinMatT (i1 ': is) (n1 ': ns)  -- | converts a typelevel slice to a concrete 'FinMat' sliceToFinMat ::   forall is ns.-  (NSC (SliceToFinMatT is ns), NSC is, NSC ns) =>+  (NS (SliceToFinMatT is ns), NS is, NS ns) =>   FinMat (SliceToFinMatT is ns) sliceToFinMat =   let is = fromNSP @is@@ -926,7 +953,7 @@ -- | get a slice by converting a typelevel slice to a concrete FinMat based slice slice ::   forall is ns a z.-  (z ~ SliceToFinMatT is ns, NSC is, NSC ns, NSC z, SliceC' z ns) =>+  (z ~ SliceToFinMatT is ns, NS is, NS ns, NS z, SliceC' z ns) =>   Mat ns a ->   SliceT' z ns a slice = sliceC' (sliceToFinMat @is @ns)@@ -934,32 +961,45 @@ -- | update a slice by converting a typelevel slice to a concrete FinMat based slice sliceUpdate ::   forall is ns a z.-  (z ~ SliceToFinMatT is ns, NSC is, NSC ns, NSC z, SliceC' z ns) =>+  (z ~ SliceToFinMatT is ns, NS is, NS ns, NS z, SliceC' z ns) =>   Mat ns a ->   SliceT' z ns a ->   Mat ns a sliceUpdate = sliceUpdateC' (sliceToFinMat @is @ns)  -- | describes the resulting type of taking a slice from the mat-type SliceT :: NonEmpty Nat -> NonEmpty Nat -> Type -> Type+type SliceT :: [Nat] -> [Nat] -> Type -> Type type family SliceT is ns a where-  SliceT (_ ':| '[]) (_ ':| '[]) a = a-  SliceT (_ ':| i ': is) (_ ':| '[]) _ =+  SliceT '[] (_ ': _) _ = GL.TypeError ( 'GL.Text "SliceT '[] (_ ': _): not defined for empty indices ns'")+  SliceT (_ ': _) '[] _ = GL.TypeError ( 'GL.Text "SliceT (_ ': _) '[]: not defined for empty indices ns")+  SliceT '[] '[] _ = GL.TypeError ( 'GL.Text "SliceT '[] '[]: not defined for empty indices ns and ns'")+  SliceT '[_] '[_] a = a+  SliceT (_ ': i ': is) '[_] _ =     GL.TypeError       ( 'GL.Text "SliceT: 'is' must be a smaller in length than 'ns'"           'GL.:<>: 'GL.Text " extra 'is'="           'GL.:<>: 'GL.ShowType (i ': is)       )-  SliceT (_ ':| '[]) (_ ':| n1 ': ns) a = Mat (n1 ':| ns) a-  SliceT (_ ':| i1 ': is) (_ ':| n1 ': ns) a = SliceT (i1 ':| is) (n1 ':| ns) a+  SliceT '[_] (_ ': n1 ': ns) a = Mat (n1 ': ns) a+  SliceT (_ ': i1 ': is) (_ ': n1 ': ns) a = SliceT (i1 ': is) (n1 ': ns) a  -- | allows viewing and updating a slice of a mat-type SliceC :: NonEmpty Nat -> NonEmpty Nat -> Constraint+type SliceC :: [Nat] -> [Nat] -> Constraint class SliceC is ns where   sliceC :: Mat ns a -> SliceT is ns a   sliceUpdateC :: Mat ns a -> SliceT is ns a -> Mat ns a -instance FinT i n => SliceC (i ':| '[]) (n ':| '[]) where+instance GL.TypeError ( 'GL.Text "SliceC '[] (n ': ns): empty indices ns'") => SliceC '[] (n ': ns) where+  sliceC = compileError "SliceC:sliceC"+  sliceUpdateC = compileError "sliceUpdateC"+instance GL.TypeError ( 'GL.Text "SliceC (n' ': ns') '[]: empty indices ns") => SliceC (n' ': ns') '[] where+  sliceC = compileError "SliceC:sliceC"+  sliceUpdateC = compileError "SliceC:sliceUpdateC"+instance GL.TypeError ( 'GL.Text "SliceC '[] '[]: empty indices ns and ns'") => SliceC '[] '[] where+  sliceC = compileError "SliceC:sliceC"+  sliceUpdateC = compileError "SliceC:sliceUpdateC"++instance FinT i n => SliceC '[i] '[n] where   sliceC (Mat v _) =     let i = fromN @i - 1      in case v V.!? i of@@ -971,7 +1011,7 @@      in case V.uncons v2 of           Just (_, v3) -> MatIU (v1 <> V.cons b v3) ps           Nothing -> programmError $ "sliceUpdateC: index " ++ show i ++ " out of bounds"-instance FinT i n => SliceC (i ':| '[]) (n ':| m ': ns) where+instance FinT i n => SliceC '[i] (n ': m ': ns) where   sliceC (Mat v (_ :| ps)) =     case ps of       m : ns ->@@ -989,11 +1029,11 @@      in MatIU (v1 <> mVec b <> v2) w  instance-  (FinT i n, SliceC (i1 ':| is) (n1 ':| ns)) =>-  SliceC (i ':| i1 ': is) (n ':| n1 ': ns)+  (FinT i n, SliceC (i1 ': is) (n1 ': ns)) =>+  SliceC (i ': i1 ': is) (n ': n1 ': ns)   where   sliceC w =-    sliceC @(i1 ':| is) @(n1 ':| ns) (sliceC @(i ':| '[]) @(n ':| n1 ': ns) w)+    sliceC @(i1 ': is) @(n1 ': ns) (sliceC @'[i] @(n ': n1 ': ns) w)   sliceUpdateC (Mat v w@(_ :| ps0)) b =     -- carve out the piece that is to be updated and pass that down then patch it all back together     case ps0 of@@ -1004,31 +1044,31 @@             v1 = V.slice 0 ((i - 1) * len) v             v2 = V.slice (i * len) (productPInt w - i * len) v             m1 = MatIU (V.slice ((i - 1) * len) len v) ps1-            mx = sliceUpdateC @(i1 ':| is) @(n1 ':| ns) m1 b+            mx = sliceUpdateC @(i1 ': is) @(n1 ': ns) m1 b          in MatIU (v1 <> mVec mx <> v2) w       [] -> programmError $ "sliceUpdateC: index " ++ show (fromN @i) ++ ": missing indices" -instance (GL.TypeError ( 'GL.Text "too many indices 'is': length is > length ns")) => SliceC (i ':| i1 ': is) (n ':| '[]) where+instance (GL.TypeError ( 'GL.Text "too many indices 'is': length is > length ns")) => SliceC (i ': i1 ': is) '[n] where   sliceC = compileError "sliceC (2)"   sliceUpdateC = compileError "sliceUpdateC (2)"  -- | a lens indexing the outermost slice _row ::-  forall (i :: Nat) (ns :: NonEmpty Nat) a.-  (SliceC (i ':| '[]) ns) =>-  Lens' (Mat ns a) (SliceT (i ':| '[]) ns a)-_row = ixSlice @(i ':| '[])+  forall (i :: Nat) (ns :: [Nat]) a.+  (SliceC '[i] ns) =>+  Lens' (Mat ns a) (SliceT '[i] ns a)+_row = ixSlice @'[i]  -- | a lens for acccessing a column _col ::   forall (i :: Nat) n m ns a.   (FinT i m) =>-  Lens' (Mat (n ':| m ': ns) a) (Mat (n ':| ns) a)+  Lens' (Mat (n ': m ': ns) a) (Mat (n ': ns) a) _col = _transposeMat . _row @i  -- | a lens for accessing a slice of a mat ixSlice ::-  forall (is :: NonEmpty Nat) (ns :: NonEmpty Nat) a.+  forall (is :: [Nat]) (ns :: [Nat]) a.   (SliceC is ns) =>   Lens' (Mat ns a) (SliceT is ns a) ixSlice =@@ -1038,22 +1078,22 @@  -- | a lens indexing a row using a concrete index 'Fin' _row' ::-  forall (n :: Nat) (ns :: NonEmpty Nat) a.-  (SliceC' (n ':| '[]) ns) =>+  forall (n :: Nat) (ns :: [Nat]) a.+  (SliceC' '[n] ns) =>   Fin n ->-  Lens' (Mat ns a) (SliceT' (n ':| '[]) ns a)-_row' (Fin i _) = ixSlice' @(n ':| '[]) (frp $ mkFinMat (unP i - 1) (succP i :| []))+  Lens' (Mat ns a) (SliceT' '[n] ns a)+_row' (Fin i _) = ixSlice' @'[n] (frp $ mkFinMat (unP i - 1) (succP i :| []))  -- | a lens for acccessing a column _col' ::   forall n m ns a.   Fin m ->-  Lens' (Mat (n ':| m ': ns) a) (Mat (n ':| ns) a)+  Lens' (Mat (n ': m ': ns) a) (Mat (n ': ns) a) _col' fn = _transposeMat . _row' fn  -- | a lens for accessing a slice of a mat ixSlice' ::-  forall (ns' :: NonEmpty Nat) (ns :: NonEmpty Nat) a.+  forall (ns' :: [Nat]) (ns :: [Nat]) a.   (SliceC' ns' ns) =>   FinMat ns' ->   Lens' (Mat ns a) (SliceT' ns' ns a)@@ -1065,8 +1105,8 @@ -- | break up into rows rows ::   forall n m ns a.-  Mat (n ':| m ': ns) a ->-  Vec n (Mat (m ':| ns) a)+  Mat (n ': m ': ns) a ->+  Vec n (Mat (m ': ns) a) rows w@(Mat _ (n :| ps)) =   case ps of     m : ns ->@@ -1077,8 +1117,8 @@ -- | unbust from rows @see 'rows' unrows ::   forall n m ns a.-  Vec n (Mat (m ':| ns) a) ->-  Mat (n ':| m ': ns) a+  Vec n (Mat (m ': ns) a) ->+  Mat (n ': m ': ns) a unrows = concatMat  -- | split up a matrix into matrix chunks of dimension "ps" and fill a container "tz"@@ -1122,17 +1162,17 @@   dotC ::     (fa -> fb -> c) ->     (NonEmpty c -> d) ->-    Mat (n ':| m ': ns) a ->-    Mat (m ':| p ': ns') b ->+    Mat (n ': m ': ns) a ->+    Mat (m ': p ': ns') b ->     Mat2 n p d  instance DotC '[] '[] a b a b where   dotC = dot-instance DotC (q ': ns) '[] a b (Mat (q ':| ns) a) b where+instance DotC (q ': ns) '[] a b (Mat (q ': ns) a) b where   dotC f g m1 m2 = dot f g (toMat2 m1) m2-instance DotC '[] (r ': xs) a b a (Mat (r ':| xs) b) where+instance DotC '[] (r ': xs) a b a (Mat (r ': xs) b) where   dotC f g m1 m2 = dot f g m1 (toMat2 m2)-instance DotC (q ': ns) (r ': xs) a b (Mat (q ':| ns) a) (Mat (r ':| xs) b) where+instance DotC (q ': ns) (r ': xs) a b (Mat (q ': ns) a) (Mat (r ': xs) b) where   dotC f g m1 m2 = dot f g (toMat2 m1) (toMat2 m2)  -- | base case for generalised dot product@@ -1165,16 +1205,16 @@ deleteRow ::   forall (i :: Nat) (n :: Nat) (ns :: [Nat]) a.   FinT i (1 GN.+ n) =>-  Mat (1 GN.+ n ':| ns) a ->-  Mat (n ':| ns) a+  Mat (1 GN.+ n ': ns) a ->+  Mat (n ': ns) a deleteRow = deleteRow' (finC @i @(1 GN.+ n))  -- | delete a row using a concrete index deleteRow' ::   forall n ns a.   Fin (1 GN.+ n) ->-  Mat (1 GN.+ n ':| ns) a ->-  Mat (n ':| ns) a+  Mat (1 GN.+ n ': ns) a ->+  Mat (n ': ns) a deleteRow' (Fin (Pos i) _) (Mat v (sn :| ps)) =   let n = frp $ predP sn       n1 = productPInt ps@@ -1187,18 +1227,18 @@ insertRow ::   forall i n m ns a.   FinT i (1 GN.+ n) =>-  Mat (m ':| ns) a ->-  Mat (n ':| m ': ns) a ->-  Mat (1 GN.+ n ':| m ': ns) a+  Mat (m ': ns) a ->+  Mat (n ': m ': ns) a ->+  Mat (1 GN.+ n ': m ': ns) a insertRow = insertRow' (finC @i @(1 GN.+ n))  -- | same as 'insertRow' but using a typelevel witness for the index insertRow' ::   forall n m ns a.   Fin (1 GN.+ n) ->-  Mat (m ':| ns) a ->-  Mat (n ':| m ': ns) a ->-  Mat (1 GN.+ n ':| m ': ns) a+  Mat (m ': ns) a ->+  Mat (n ': m ': ns) a ->+  Mat (1 GN.+ n ': m ': ns) a insertRow' (Fin (Pos i) _) (Mat v0 _) (Mat v (p :| ps)) =   let s = (i - 1) * productPInt ps       v1 = V.slice 0 s v@@ -1209,42 +1249,42 @@ deleteCol ::   forall (i :: Nat) (n :: Nat) (n1 :: Nat) ns a.   FinT i (1 GN.+ n1) =>-  Mat (n ':| (1 GN.+ n1) ': ns) a ->-  Mat (n ':| n1 ': ns) a+  Mat (n ': (1 GN.+ n1) ': ns) a ->+  Mat (n ': n1 ': ns) a deleteCol = deleteCol' (finC @i @(1 GN.+ n1))  -- | same as 'deleteCol' but using a typelevel witness for the index deleteCol' ::   forall (n :: Nat) (n1 :: Nat) ns a.   Fin (1 GN.+ n1) ->-  Mat (n ':| (1 GN.+ n1) ': ns) a ->-  Mat (n ':| n1 ': ns) a+  Mat (n ': (1 GN.+ n1) ': ns) a ->+  Mat (n ': n1 ': ns) a deleteCol' fn = transposeMat @n1 @n . deleteRow' @n1 fn . transposeMat @n @(1 GN.+ n1)  -- | insert a column into a mat (2d and above) insertCol ::   forall (i :: Nat) (n :: Nat) (n1 :: Nat) ns a.   FinT i (1 GN.+ n1) =>-  Mat (n ':| ns) a ->-  Mat (n ':| n1 ': ns) a ->-  Mat (n ':| (1 GN.+ n1) ': ns) a+  Mat (n ': ns) a ->+  Mat (n ': n1 ': ns) a ->+  Mat (n ': (1 GN.+ n1) ': ns) a insertCol = insertCol' (finC @i @(1 GN.+ n1))  -- | same as 'insertCol' but using a typelevel witness 'Fin' insertCol' ::   forall (n :: Nat) (n1 :: Nat) ns a.   Fin (1 GN.+ n1) ->-  Mat (n ':| ns) a ->-  Mat (n ':| n1 ': ns) a ->-  Mat (n ':| (1 GN.+ n1) ': ns) a+  Mat (n ': ns) a ->+  Mat (n ': n1 ': ns) a ->+  Mat (n ': (1 GN.+ n1) ': ns) a insertCol' fn v = transposeMat @(1 GN.+ n1) @n . insertRow' fn v . transposeMat @n @n1  -- | swaps mat rows (1d or more) swapRow ::   forall (i :: Nat) (j :: Nat) (n :: Nat) ns a.   (FinT i n, FinT j n) =>-  Mat (n ':| ns) a ->-  Mat (n ':| ns) a+  Mat (n ': ns) a ->+  Mat (n ': ns) a swapRow = swapRow' (finC @i) (finC @j)  -- | swaps mat rows (1d or more)@@ -1252,8 +1292,8 @@   forall (n :: Nat) ns a.   Fin n ->   Fin n ->-  Mat (n ':| ns) a ->-  Mat (n ':| ns) a+  Mat (n ': ns) a ->+  Mat (n ': ns) a swapRow' (Fin ix _) (Fin jx _) z@(Mat v w@(_ :| ps)) =   let (Pos i, Pos j) = bool id swap (ix > jx) (ix, jx)       len = productPInt ps@@ -1273,8 +1313,8 @@ swapCol ::   forall (i :: Nat) (j :: Nat) (n :: Nat) (n1 :: Nat) ns a.   (FinT i n1, FinT j n1) =>-  Mat (n ':| n1 ': ns) a ->-  Mat (n ':| n1 ': ns) a+  Mat (n ': n1 ': ns) a ->+  Mat (n ': n1 ': ns) a swapCol = swapCol' (finC @i) (finC @j)  -- | swaps mat rows (2d or more)@@ -1282,13 +1322,13 @@   forall (n :: Nat) (n1 :: Nat) ns a.   Fin n1 ->   Fin n1 ->-  Mat (n ':| n1 ': ns) a ->-  Mat (n ':| n1 ': ns) a+  Mat (n ': n1 ': ns) a ->+  Mat (n ': n1 ': ns) a swapCol' fni fnj = transposeMat . swapRow' fni fnj . transposeMat  -- | swaps a single value "a" from any location to any other location using type level indexes swapMat ::-  forall (is :: NonEmpty Nat) (js :: NonEmpty Nat) ns a.+  forall (is :: [Nat]) (js :: [Nat]) ns a.   (FinMatC is ns, FinMatC js ns) =>   Mat ns a ->   Mat ns a@@ -1306,18 +1346,18 @@  -- | append two matrices vertically appendV ::-  Mat (n ':| ns) a ->-  Mat (n' ':| ns) a ->-  Mat ((n GN.+ n') ':| ns) a+  Mat (n ': ns) a ->+  Mat (n' ': ns) a ->+  Mat ((n GN.+ n') ': ns) a appendV (Mat v (p :| ps)) (Mat v1 (p1 :| _)) =   MatIU (v <> v1) ((p +! p1) :| ps)  -- | append two matrices horizontally appendH ::   forall n m m' ns a.-  Mat (n ':| m ': ns) a ->-  Mat (n ':| m' ': ns) a ->-  Mat (n ':| (m GN.+ m') ': ns) a+  Mat (n ': m ': ns) a ->+  Mat (n ': m' ': ns) a ->+  Mat (n ': (m GN.+ m') ': ns) a appendH w@(Mat _ (n :| ps)) w1@(Mat _ (n' :| ps1))   | n == n' =       case (ps, ps1) of@@ -1341,13 +1381,13 @@    in MatIU (V.fromList $ concat ret) (lhs :| [p])  -- | find all elements in a mat that match the predicate-findMatElems :: NSC ns => (a -> Bool) -> Mat ns a -> [(FinMat ns, a)]+findMatElems :: NS ns => (a -> Bool) -> Mat ns a -> [(FinMat ns, a)] findMatElems p = ifoldMap (\i a -> bool [] [(i, a)] (p a))  -- | generate a 'Mat' with the given past and future rep values and a user state buildMat ::   forall ns a b.-  NSC ns =>+  NS ns =>   ([FinMat ns] -> [FinMat ns] -> b -> FinMat ns -> (b, a)) ->   b ->   (b, Mat ns a)@@ -1356,9 +1396,9 @@ -- | cartesian product of two matrices with a combining function cartesian ::   (a -> b -> c) ->-  Mat (n ':| ns) a ->-  Mat (n' ':| ns') b ->-  Mat (n ':| ns TP.++ n' ': ns') c+  Mat (n ': ns) a ->+  Mat (n' ': ns') b ->+  Mat (n ': ns TP.++ n' ': ns') c cartesian f (Mat v ps) (Mat v1 ps1) =   MatIU (liftA2 f v v1) (ps <> ps1) @@ -1398,13 +1438,14 @@   g m (fm, a) = setMat a fm m  -- | convert a matrix to a nested tuple-type MatTupleT :: NonEmpty Nat -> Type -> Type+type MatTupleT :: [Nat] -> Type -> Type type family MatTupleT ns a where-  MatTupleT (n ':| '[]) a = ListTupleT n a-  MatTupleT (n ':| n1 ': ns) a = ListTupleT n (MatTupleT (n1 ':| ns) a)+  MatTupleT '[] _ = GL.TypeError ('GL.Text "MatTupleT '[]: undefined for empty indices")+  MatTupleT '[n] a = ListTupleT n a+  MatTupleT (n ': n1 ': ns) a = ListTupleT n (MatTupleT (n1 ': ns) a)  -- | convert a between a matrix and a nested tuple-type MatTupleC :: NonEmpty Nat -> Type -> Constraint+type MatTupleC :: [Nat] -> Type -> Constraint class MatTupleC ns a where   toTupleC ::     Mat ns a ->@@ -1423,24 +1464,30 @@     -- | traversal over a well-formed nested tuple     Traversal (MatTupleT ns a) (MatTupleT ns b) a b -instance ListTupleCInternal n => MatTupleC (n ':| '[]) a where-  toTupleC lst = toTupleCInternal lst-  fromTupleC x = fromTupleCInternal x+instance GL.TypeError ('GL.Text "MatTupleC '[]: undefined for empty indices") => MatTupleC '[] a where+  toTupleC = compileError "MatTupleC:toTupleC"+  fromTupleC = compileError "MatTupleC:fromTupleC"+  fmapTupleMatC = compileError "MatTupleC:fmapTupleMatC"+  traversalTupleMatC = compileError "MatTupleC:traversalTupleMatC"++instance ListTupleCInternal n => MatTupleC '[n] a where+  toTupleC  = toTupleCInternal+  fromTupleC = fromTupleCInternal   fmapTupleMatC = fmapTupleInternal   traversalTupleMatC = traversalTupleCInternal instance-  (ListTupleCInternal n, NSC (n1 ':| ns), MatTupleC (n1 ':| ns) a) =>-  MatTupleC (n ':| n1 ': ns) a+  (ListTupleCInternal n, NS (n1 ': ns), MatTupleC (n1 ': ns) a) =>+  MatTupleC (n ': n1 ': ns) a   where-  toTupleC lst = toTupleCInternal @n (fmap (toTupleC @(n1 ':| ns)) (rows @n lst))+  toTupleC lst = toTupleCInternal @n (fmap (toTupleC @(n1 ': ns)) (rows @n lst))   fromTupleC x =-    let Mat v (n' :| _) = fromTupleCInternal (fmapTupleInternal (fromTupleC @(n1 ':| ns)) x)+    let Mat v (n' :| _) = fromTupleCInternal (fmapTupleInternal (fromTupleC @(n1 ': ns)) x)         xs = foldMap mVec v-        ps1 = n' N.<| fromNSP @(n1 ':| ns)-     in MatIU @(n ':| n1 ': ns) xs ps1+        ps1 = n' N.<| fromNSP @(n1 ': ns)+     in MatIU @(n ': n1 ': ns) xs ps1 -  fmapTupleMatC f x = fmapTupleInternal (fmapTupleMatC @(n1 ':| ns) f) x -- below requires @(NS ns) cos i need to explicitly specify @(n1 ':| ns) here-  traversalTupleMatC afa = traversalTupleCInternal @n (traversalTupleMatC @(n1 ':| ns) afa)+  fmapTupleMatC f x = fmapTupleInternal (fmapTupleMatC @(n1 ': ns) f) x+  traversalTupleMatC afa = traversalTupleCInternal @n (traversalTupleMatC @(n1 ': ns) afa)  -- | fmap over a n-tuple fmapTupleInternal :: ListTupleCInternal n => (a -> b) -> ListTupleT n a -> ListTupleT n b@@ -1510,11 +1557,11 @@   traversalTupleCInternal afa (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) = (,,,,,,,,,) <$> afa a1 <*> afa a2 <*> afa a3 <*> afa a4 <*> afa a5 <*> afa a6 <*> afa a7 <*> afa a8 <*> afa a9 <*> afa a10  -- | an iso for transposing a matrix-_transposeMat :: Iso (Mat (n ':| m ': ns) a) (Mat (n ':| m ': ns) b) (Mat (m ':| n ': ns) a) (Mat (m ':| n ': ns) b)+_transposeMat :: Iso (Mat (n ': m ': ns) a) (Mat (n ': m ': ns) b) (Mat (m ': n ': ns) a) (Mat (m ': n ': ns) b) _transposeMat = iso transposeMat transposeMat  -- | transpose a 2d or larger matrix-transposeMat :: forall n m ns a. Mat (n ':| m ': ns) a -> Mat (m ':| n ': ns) a+transposeMat :: forall n m ns a. Mat (n ': m ': ns) a -> Mat (m ': n ': ns) a transposeMat w@(Mat _ (n :| ps)) =   case ps of     [] -> programmError "transposeMat"@@ -1555,46 +1602,55 @@   -- | convert a nested nonempty list to a 'Mat'   nestedNonEmptyToMatC :: NonEmptyNST ns a -> Either String (Mat ns a) -instance PosT n => MatConvertersC (n ':| '[]) where+instance GL.TypeError ('GL.Text "MatConvertersC '[]: undefined for empty indices") => MatConvertersC '[] where+  matToNestedVecC = compileError "MatConvertersC"+  nestedVecToMatC = compileError "MatConvertersC"+  matToNestedListC = compileError "MatConvertersC"+  matToNestedNonEmptyC = compileError "MatConvertersC"+  nestedListToMatC = compileError "MatConvertersC"+  nestedNonEmptyToMatC = compileError "MatConvertersC"++instance PosT n => MatConvertersC '[n] where   matToNestedVecC = id   nestedVecToMatC = id   matToNestedListC = toListMat   matToNestedNonEmptyC = toNonEmptyMat   nestedListToMatC = matImpl True   nestedNonEmptyToMatC = matImpl True . N.toList-instance (PosT n, MatConvertersC (m ':| ns)) => MatConvertersC (n ':| m ': ns) where+instance (PosT n, MatConvertersC (m ': ns)) => MatConvertersC (n ': m ': ns) where   matToNestedVecC lst = fmap matToNestedVecC (rows @n lst)   nestedVecToMatC lst@(Mat _ (n :| _)) =-    let zs@(Mat _ (m :| ns) :| _) = toNonEmptyMat $ fmap (nestedVecToMatC @(m ':| ns)) lst+    let zs@(Mat _ (m :| ns) :| _) = toNonEmptyMat $ fmap (nestedVecToMatC @(m ': ns)) lst         ys = foldMap mVec zs      in MatIU ys (n :| m : ns)-  matToNestedListC w = toListMat $ fmap (matToNestedListC @(m ':| ns)) (rows @n w)-  matToNestedNonEmptyC w = toNonEmptyMat $ fmap (matToNestedNonEmptyC @(m ':| ns)) (rows @n w)+  matToNestedListC w = toListMat $ fmap (matToNestedListC @(m ': ns)) (rows @n w)+  matToNestedNonEmptyC w = toNonEmptyMat $ fmap (matToNestedNonEmptyC @(m ': ns)) (rows @n w)   nestedListToMatC = \case     [] -> Left "nestedListToMatC: no data"-    w : ws -> nonEmptyMatsToMat =<< traverse (nestedListToMatC @(m ':| ns)) (w :| ws)-  nestedNonEmptyToMatC w = nonEmptyMatsToMat =<< traverse (nestedNonEmptyToMatC @(m ':| ns)) w+    w : ws -> nonEmptyMatsToMat =<< traverse (nestedListToMatC @(m ': ns)) (w :| ws)+  nestedNonEmptyToMatC w = nonEmptyMatsToMat =<< traverse (nestedNonEmptyToMatC @(m ': ns)) w  -- | create a matrix of one dimension higher from rows of a sub matrix-nonEmptyMatsToMat :: forall n m ns a t. (Foldable1 t, PosT n) => t (Mat (m ':| ns) a) -> Either String (Mat (n ':| m ': ns) a)+nonEmptyMatsToMat :: forall n m ns a t. (Foldable1 t, PosT n) => t (Mat (m ': ns) a) -> Either String (Mat (n ': m ': ns) a) nonEmptyMatsToMat (toNonEmpty -> xs@(Mat _ ps :| _)) = do   let n = fromNP @n   ret <- lengthExact1 n xs   pure $ MatIU (sconcat (fmap mVec ret)) (n N.<| ps)  -- | converts mat dimensions to a nested list-type MatToNestedVecT :: NonEmpty Nat -> Type -> Type+type MatToNestedVecT :: [Nat] -> Type -> Type type family MatToNestedVecT ns a where-  MatToNestedVecT (n ':| '[]) a = Vec n a-  MatToNestedVecT (n ':| n1 ': ns) a = Vec n (MatToNestedVecT (n1 ':| ns) a)+  MatToNestedVecT '[] _ = GL.TypeError ('GL.Text "MatToNestedVecT '[]: undefined for empty indices")+  MatToNestedVecT '[n] a = Vec n a+  MatToNestedVecT (n ': n1 ': ns) a = Vec n (MatToNestedVecT (n1 ': ns) a)  -- | type synonym for the result of nesting a matrix: @see 'toND'-type MatToNDT :: Nat -> NonEmpty Nat -> Type -> Type+type MatToNDT :: Nat -> [Nat] -> Type -> Type type MatToNDT i ns a = Mat (MatToMatNTA (NatToPeanoT i) ns) (Mat (MatToMatNTB (NatToPeanoT i) ns) a)  -- | create a nested matrix going "i" levels down: noop is not supported ie 4D matrix to a 4D matrix matToNDImpl ::-  forall (i :: Nat) (ns :: NonEmpty Nat) a.+  forall (i :: Nat) (ns :: [Nat]) a.   PosT i =>   Mat ns a ->   MatToNDT i ns a@@ -1608,23 +1664,27 @@            in MatIU (V.fromList xs) ps1         [] -> programmError "toND:missing indices to the right" -type MatToMatNTA :: Peano -> NonEmpty Nat -> NonEmpty Nat+type MatToMatNTA :: Peano -> [Nat] -> [Nat] type family MatToMatNTA i ns where-  MatToMatNTA ( 'S 'Z) (_ ':| '[]) =+  MatToMatNTA _ '[] =+    GL.TypeError ( 'GL.Text "MatToMatNTA '[]: empty indices")+  MatToMatNTA ( 'S 'Z) '[_] =     GL.TypeError ( 'GL.Text "MatToMatNTA: noop as the depth 'i' is the same as the number of indices")-  MatToMatNTA ( 'S 'Z) (n ':| _ ': _) = n ':| '[]-  MatToMatNTA ( 'S _) (_ ':| '[]) =+  MatToMatNTA ( 'S 'Z) (n ': _ ': _) = '[n]+  MatToMatNTA ( 'S _) '[_] =     GL.TypeError ( 'GL.Text "MatToMatNTA: depth is more than the number of indices")-  MatToMatNTA ( 'S ( 'S i)) (n ':| m ': ns) = TP.Cons1T n (MatToMatNTA ( 'S i) (m ':| ns))+  MatToMatNTA ( 'S ( 'S i)) (n ': m ': ns) = n : MatToMatNTA ( 'S i) (m ': ns) -type MatToMatNTB :: Peano -> NonEmpty Nat -> NonEmpty Nat+type MatToMatNTB :: Peano -> [Nat] -> [Nat] type family MatToMatNTB i ns where-  MatToMatNTB ( 'S 'Z) (_ ':| '[]) =+  MatToMatNTB _ '[] =+    GL.TypeError ( 'GL.Text "MatToMatNTB: empty indices")+  MatToMatNTB ( 'S 'Z) '[_] =     GL.TypeError ( 'GL.Text "MatToMatNTB: noop as the depth 'i' is the same as the number of indices")-  MatToMatNTB ( 'S 'Z) (_ ':| m ': ns) = m ':| ns-  MatToMatNTB ( 'S _) (_ ':| '[]) =+  MatToMatNTB ( 'S 'Z) (_ ': m ': ns) = m ': ns+  MatToMatNTB ( 'S _) '[_] =     GL.TypeError ( 'GL.Text "MatToMatNTB: depth is more than the number of indices")-  MatToMatNTB ( 'S ( 'S i)) (_ ':| m ': ns) = MatToMatNTB ( 'S i) (m ':| ns)+  MatToMatNTB ( 'S ( 'S i)) (_ ': m ': ns) = MatToMatNTB ( 'S i) (m ': ns)  -- | create a nd matrix using a Nat @see 'toND toND :: forall i ns a. i <=! i => Mat ns a -> MatToNDT i ns a@@ -1645,14 +1705,14 @@ -- | squash a single nested matrix together into one concatMat ::   forall (n :: Nat) (ns :: [Nat]) (m :: Nat) (ms :: [Nat]) a.-  Mat (n ':| ns) (Mat (m ':| ms) a) ->-  Mat (n ':| (ns TP.++ m ': ms)) a+  Mat (n ': ns) (Mat (m ': ms) a) ->+  Mat (n ': (ns TP.++ m ': ms)) a concatMat w =   let hd :| tl = toNonEmptyMat w    in MatIU (V.concat (map mVec (hd : tl))) (mIndices w <> mIndices hd)  -- | gets the diagonal elements of a 2d or greater square matrix: the diagonal of a n * n * ns matrix results in a n * ns matrix-diagonal :: Mat (n ':| n ': ns) a -> Mat (n ':| ns) a+diagonal :: Mat (n ': n ': ns) a -> Mat (n ': ns) a diagonal (Mat v (n :| ps)) =   case ps of     _n : ns ->@@ -1665,8 +1725,8 @@ subsetRows ::   forall i j n ns a.   DiffTC i j n =>-  Mat (n ':| ns) a ->-  Mat (DiffT i j n ':| ns) a+  Mat (n ': ns) a ->+  Mat (DiffT i j n ': ns) a subsetRows (Mat v (_ :| ns)) =   let i = fromNP @i       j = fromNP @j@@ -1681,30 +1741,18 @@ subsetCols ::   forall i j m n ns a.   DiffTC i j n =>-  Mat (m ':| n ': ns) a ->-  Mat (m ':| (DiffT i j n ': ns)) a+  Mat (m ': n ': ns) a ->+  Mat (m ': (DiffT i j n ': ns)) a subsetCols = transposeMat . subsetRows @i @j . transposeMat -{- | shortcut way to construct a matrix with indices as the individual digits of the 'Nat' value- @see 'gen''--}-mm' :: forall n. NSC (NN n) => Mat (NN n) [Int]-mm' = gen' id--{- | shortcut way to construct a matrix with indices as the individual digits of the 'Nat' value- @see 'gen'--}-mm :: forall n. NSC (NN n) => Mat (NN n) Int-mm = gen (+ 1)- -- | isomorphism for nesting/unnesting a matrix one level deep _rows ::   forall n m ns a b.   Iso-    (Mat (n ':| m ': ns) a)-    (Mat (n ':| m ': ns) b)-    (Vec n (Mat (m ':| ns) a))-    (Vec n (Mat (m ':| ns) b))+    (Mat (n ': m ': ns) a)+    (Mat (n ': m ': ns) b)+    (Vec n (Mat (m ': ns) a))+    (Vec n (Mat (m ': ns) b)) _rows = iso rows unrows  toListMat :: Mat ns a -> [a]@@ -1715,7 +1763,7 @@  -- | specialised version of 'readMat' for 'Vec' readVec ::-  ( MatConvertersC (n ':| '[])+  ( MatConvertersC '[n]   , PosT n   , Read [a]   ) =>@@ -1724,7 +1772,7 @@  -- | specialised version of 'readMat' for 'Mat2' readMat2 ::-  ( MatConvertersC (n ':| '[m])+  ( MatConvertersC '[n, m]   , PosT n   , PosT m   , Read [[a]]@@ -1736,20 +1784,20 @@ readMat ::   forall ns a.   ( MatConvertersC ns-  , NSC ns+  , NS ns   , Read (ListNST ns a)   ) =>   ReadS (Mat ns a) readMat = P.readP_to_S (readMatP defShowOpts) -instance (MatConvertersC ns, NSC ns, Read (ListNST ns a)) => Read (Mat ns a) where+instance (MatConvertersC ns, NS ns, Read (ListNST ns a)) => Read (Mat ns a) where   readPrec = PC.readP_to_Prec (const (readMatP defShowOpts))  -- | reader for 'showFin' readMatP ::   forall ns a.   ( MatConvertersC ns-  , NSC ns+  , NS ns   , Read (ListNST ns a)   ) =>   ShowOpts ->@@ -1806,7 +1854,7 @@     then smInlineNewLineEof opts     else smOtherNewLineEof opts -instance (Show a, ShowMatC ns, NSC ns) => Show (Mat ns a) where+instance (Show a, ShowMatC ns, NS ns) => Show (Mat ns a) where   show = showMat defShowOpts  -- | show a matrix@@ -1828,12 +1876,15 @@    showMatC' :: Show a => Int -> Int -> ShowOpts -> Mat ns a -> [String] -instance ShowMatC (n ':| '[]) where+instance GL.TypeError ( 'GL.Text "ShowMatC '[]: empty indices") => ShowMatC '[] where+  showMatC' = compileError "ShowMatC '[]:showMatC'"++instance ShowMatC '[n] where   showMatC' i j _ (Mat v _) =     let ret0 = show (V.toList v)      in L.lines $ ret0 ++ if i == j then mempty else "," -instance ShowMatC (m ':| ns) => ShowMatC (n ':| m ': ns) where+instance ShowMatC (m ': ns) => ShowMatC (n ': m ': ns) where   showMatC' i j opts w@(Mat _ (n :| _)) =     let xs = toListMat $ rows w         zz = replicate (3 + smIndent0 opts) ' ' -- 3 == length of "],["@@ -1889,105 +1940,105 @@   _r10 :: Lens' s a  -- | lens into the first row in a 2d or greater matrix-instance FinT 1 n => Row1 (Mat (n ':| m ': ns) a) (Mat (m ':| ns) a) where+instance FinT 1 n => Row1 (Mat (n ': m ': ns) a) (Mat (m ': ns) a) where   _r1 = _row @1  -- |  lens into the first element in a 1d matrix instance FinT 1 n => Row1 (Vec n a) a where   _r1 = _row @1 -instance (FinT 2 n) => Row2 (Mat (n ':| m ': ns) a) (Mat (m ':| ns) a) where+instance (FinT 2 n) => Row2 (Mat (n ': m ': ns) a) (Mat (m ': ns) a) where   _r2 = _row @2  instance (FinT 2 n) => Row2 (Vec n a) a where   _r2 = _row @2 -instance (FinT 3 n) => Row3 (Mat (n ':| m ': ns) a) (Mat (m ':| ns) a) where+instance (FinT 3 n) => Row3 (Mat (n ': m ': ns) a) (Mat (m ': ns) a) where   _r3 = _row @3  instance (FinT 3 n) => Row3 (Vec n a) a where   _r3 = _row @3 -instance (FinT 4 n) => Row4 (Mat (n ':| m ': ns) a) (Mat (m ':| ns) a) where+instance (FinT 4 n) => Row4 (Mat (n ': m ': ns) a) (Mat (m ': ns) a) where   _r4 = _row @4  instance (FinT 4 n) => Row4 (Vec n a) a where   _r4 = _row @4 -instance (FinT 5 n) => Row5 (Mat (n ':| m ': ns) a) (Mat (m ':| ns) a) where+instance (FinT 5 n) => Row5 (Mat (n ': m ': ns) a) (Mat (m ': ns) a) where   _r5 = _row @5  instance (FinT 5 n) => Row5 (Vec n a) a where   _r5 = _row @5 -instance (FinT 6 n) => Row6 (Mat (n ':| m ': ns) a) (Mat (m ':| ns) a) where+instance (FinT 6 n) => Row6 (Mat (n ': m ': ns) a) (Mat (m ': ns) a) where   _r6 = _row @6  instance (FinT 6 n) => Row6 (Vec n a) a where   _r6 = _row @6 -instance (FinT 7 n) => Row7 (Mat (n ':| m ': ns) a) (Mat (m ':| ns) a) where+instance (FinT 7 n) => Row7 (Mat (n ': m ': ns) a) (Mat (m ': ns) a) where   _r7 = _row @7  instance (FinT 7 n) => Row7 (Vec n a) a where   _r7 = _row @7 -instance (FinT 8 n) => Row8 (Mat (n ':| m ': ns) a) (Mat (m ':| ns) a) where+instance (FinT 8 n) => Row8 (Mat (n ': m ': ns) a) (Mat (m ': ns) a) where   _r8 = _row @8  instance (FinT 8 n) => Row8 (Vec n a) a where   _r8 = _row @8 -instance (FinT 9 n) => Row9 (Mat (n ':| m ': ns) a) (Mat (m ':| ns) a) where+instance (FinT 9 n) => Row9 (Mat (n ': m ': ns) a) (Mat (m ': ns) a) where   _r9 = _row @9  instance (FinT 9 n) => Row9 (Vec n a) a where   _r9 = _row @9 -instance (FinT 10 n) => Row10 (Mat (n ':| m ': ns) a) (Mat (m ':| ns) a) where+instance (FinT 10 n) => Row10 (Mat (n ': m ': ns) a) (Mat (m ': ns) a) where   _r10 = _row @10  instance (FinT 10 n) => Row10 (Vec n a) a where   _r10 = _row @10  -- | lens into column 1 of a matrix-_c1 :: FinT 1 m => Lens' (Mat (n ':| (m : ns)) a) (Mat (n ':| ns) a)+_c1 :: FinT 1 m => Lens' (Mat (n ': (m : ns)) a) (Mat (n ': ns) a) _c1 = _col @1  -- | lens into column 2 of a matrix-_c2 :: FinT 2 m => Lens' (Mat (n ':| (m : ns)) a) (Mat (n ':| ns) a)+_c2 :: FinT 2 m => Lens' (Mat (n ': (m : ns)) a) (Mat (n ': ns) a) _c2 = _col @2  -- | lens into column 3 of a matrix-_c3 :: FinT 3 m => Lens' (Mat (n ':| (m : ns)) a) (Mat (n ':| ns) a)+_c3 :: FinT 3 m => Lens' (Mat (n ': (m : ns)) a) (Mat (n ': ns) a) _c3 = _col @3  -- | lens into column 4 of a matrix-_c4 :: FinT 4 m => Lens' (Mat (n ':| (m : ns)) a) (Mat (n ':| ns) a)+_c4 :: FinT 4 m => Lens' (Mat (n ': (m : ns)) a) (Mat (n ': ns) a) _c4 = _col @4  -- | lens into column 5 of a matrix-_c5 :: FinT 5 m => Lens' (Mat (n ':| (m : ns)) a) (Mat (n ':| ns) a)+_c5 :: FinT 5 m => Lens' (Mat (n ': (m : ns)) a) (Mat (n ': ns) a) _c5 = _col @5  -- | lens into column 6 of a matrix-_c6 :: FinT 6 m => Lens' (Mat (n ':| (m : ns)) a) (Mat (n ':| ns) a)+_c6 :: FinT 6 m => Lens' (Mat (n ': (m : ns)) a) (Mat (n ': ns) a) _c6 = _col @6  -- | lens into column 7 of a matrix-_c7 :: FinT 7 m => Lens' (Mat (n ':| (m : ns)) a) (Mat (n ':| ns) a)+_c7 :: FinT 7 m => Lens' (Mat (n ': (m : ns)) a) (Mat (n ': ns) a) _c7 = _col @7  -- | lens into column 8 of a matrix-_c8 :: FinT 8 m => Lens' (Mat (n ':| (m : ns)) a) (Mat (n ':| ns) a)+_c8 :: FinT 8 m => Lens' (Mat (n ': (m : ns)) a) (Mat (n ': ns) a) _c8 = _col @8  -- | lens into column 9 of a matrix-_c9 :: FinT 9 m => Lens' (Mat (n ':| (m : ns)) a) (Mat (n ':| ns) a)+_c9 :: FinT 9 m => Lens' (Mat (n ': (m : ns)) a) (Mat (n ': ns) a) _c9 = _col @9  -- | lens into column 10 of a matrix-_c10 :: FinT 10 m => Lens' (Mat (n ':| (m : ns)) a) (Mat (n ':| ns) a)+_c10 :: FinT 10 m => Lens' (Mat (n ': (m : ns)) a) (Mat (n ': ns) a) _c10 = _col @10  -- | marker representing the last value in a 1d matrix ie singleton@@ -1996,22 +2047,24 @@ -- | marker representing the last row in a nd matrix ie singleton data EofN = EofN deriving stock (Show, Eq, Generic) -type ConsMatCTA :: NonEmpty Nat -> Type -> Type+type ConsMatCTA :: [Nat] -> Type -> Type type family ConsMatCTA ns a where-  ConsMatCTA (1 ':| '[]) a = a-  ConsMatCTA (_ ':| '[]) a = a-  ConsMatCTA (1 ':| m ': ns) a = Mat (m ':| ns) a-  ConsMatCTA (_ ':| m ': ns) a = Mat (m ':| ns) a+  ConsMatCTA '[] _ = GL.TypeError ( 'GL.Text "ConsMatCTA '[]: empty indices")+  ConsMatCTA '[1] a = a+  ConsMatCTA '[_] a = a+  ConsMatCTA (1 ': m ': ns) a = Mat (m ': ns) a+  ConsMatCTA (_ ': m ': ns) a = Mat (m ': ns) a -type ConsMatCTB :: NonEmpty Nat -> Type -> Type+type ConsMatCTB :: [Nat] -> Type -> Type type family ConsMatCTB ns a where-  ConsMatCTB (1 ':| '[]) _ = Eof1-  ConsMatCTB (n ':| '[]) a = Vec (n GN.- 1) a-  ConsMatCTB (1 ':| _ ': _) _ = EofN-  ConsMatCTB (n ':| m ': ns) a = Mat ((n GN.- 1) ':| m ': ns) a+  ConsMatCTB '[] _ = GL.TypeError ( 'GL.Text "ConsMatCTB '[]: empty indices")+  ConsMatCTB '[1] _ = Eof1+  ConsMatCTB '[n] a = Vec (n GN.- 1) a+  ConsMatCTB (1 ': _ ': _) _ = EofN+  ConsMatCTB (n ': m ': ns) a = Mat ((n GN.- 1) ': m ': ns) a  -- | iso and lenses to uncons a matrix-type ConsMatC :: NonEmpty Nat -> Type -> Type -> Constraint+type ConsMatC :: [Nat] -> Type -> Type -> Constraint class ConsMatC ns a b where   consMat ::     Iso@@ -2027,59 +2080,59 @@  instance   {-# OVERLAPPING #-}-  ( ConsMatCTA (1 ':| '[]) a ~ a-  , ConsMatCTA (1 ':| '[]) b ~ b-  , ConsMatCTB (1 ':| '[]) a ~ Eof1-  , ConsMatCTB (1 ':| '[]) b ~ Eof1+  ( ConsMatCTA '[1] a ~ a+  , ConsMatCTA '[1] b ~ b+  , ConsMatCTB '[1] a ~ Eof1+  , ConsMatCTB '[1] b ~ Eof1   ) =>-  ConsMatC (1 ':| '[]) a b+  ConsMatC '[1] a b   where   consMat = iso (\m -> (V.head (mVec m), Eof1)) (\(a, Eof1) -> se1 a) instance   {-# OVERLAPPABLE #-}-  ( ConsMatCTA (n ':| '[]) a ~ a-  , ConsMatCTA (n ':| '[]) b ~ b-  , ConsMatCTB (n ':| '[]) a ~ Vec (n GN.- 1) a-  , ConsMatCTB (n ':| '[]) b ~ Vec (n GN.- 1) b+  ( ConsMatCTA '[n] a ~ a+  , ConsMatCTA '[n] b ~ b+  , ConsMatCTB '[n] a ~ Vec (n GN.- 1) a+  , ConsMatCTB '[n] b ~ Vec (n GN.- 1) b   ) =>-  ConsMatC (n ':| '[]) a b+  ConsMatC '[n] a b   where   consMat =     iso       ( \(Mat v0 (sn :| ps)) ->           let n = frp $ predP sn            in case V.uncons v0 of -- stay within Vector-                Nothing -> programmError "consMat (1 GN.+ n ':| '[]): no data"+                Nothing -> programmError "consMat '[1 GN.+ n]: no data"                 Just (a, v) -> (a, MatIU v (n :| ps))       )       (\(a, Mat v (p :| ps)) -> MatIU (V.cons a v) (succP p :| ps))  instance   {-# OVERLAPPING #-}-  ( ConsMatCTA (1 ':| m ': ns) a ~ Mat (m ':| ns) a-  , ConsMatCTA (1 ':| m ': ns) b ~ Mat (m ':| ns) b-  , ConsMatCTB (1 ':| m ': ns) a ~ EofN-  , ConsMatCTB (1 ':| m ': ns) b ~ EofN+  ( ConsMatCTA (1 ': m ': ns) a ~ Mat (m ': ns) a+  , ConsMatCTA (1 ': m ': ns) b ~ Mat (m ': ns) b+  , ConsMatCTB (1 ': m ': ns) a ~ EofN+  , ConsMatCTB (1 ': m ': ns) b ~ EofN   ) =>-  ConsMatC (1 ':| n1 ': ns) a b+  ConsMatC (1 ': n1 ': ns) a b   where   consMat =     iso       ( \(Mat v (_ :| ps)) ->           case ps of             m : ns -> (MatIU v (m :| ns), EofN)-            [] -> programmError "consMat (1 ':| m ': ns): missing indices"+            [] -> programmError "consMat (1 ': m ': ns): missing indices"       )       (\(Mat v ps, EofN) -> MatIU v (_1P N.<| ps))  instance   {-# OVERLAPPING #-}-  ( ConsMatCTA (n ':| m ': ns) a ~ Mat (m ':| ns) a-  , ConsMatCTA (n ':| m ': ns) b ~ Mat (m ':| ns) b-  , ConsMatCTB (n ':| m ': ns) a ~ Mat ((n GN.- 1) ':| m ': ns) a-  , ConsMatCTB (n ':| m ': ns) b ~ Mat ((n GN.- 1) ':| m ': ns) b+  ( ConsMatCTA (n ': m ': ns) a ~ Mat (m ': ns) a+  , ConsMatCTA (n ': m ': ns) b ~ Mat (m ': ns) b+  , ConsMatCTB (n ': m ': ns) a ~ Mat ((n GN.- 1) ': m ': ns) a+  , ConsMatCTB (n ': m ': ns) b ~ Mat ((n GN.- 1) ': m ': ns) b   ) =>-  ConsMatC (n ':| m ': ns) a b+  ConsMatC (n ': m ': ns) a b   where   consMat =     iso@@ -2093,12 +2146,12 @@                in ( MatIU v1 ps1                   , MatIU v2 ps2                   )-            [] -> programmError "consMatX:(1 GN.+ n ':| m ': ns): missing indices"+            [] -> programmError "consMat:(1 GN.+ n ': m ': ns): missing indices"       )       (\(Mat v1 _, Mat v2 (p2 :| ps2)) -> MatIU (v1 <> v2) (succP p2 :| ps2))  -- | iso and lenses to unsnoc a matrix-type SnocMatC :: NonEmpty Nat -> Type -> Type -> Constraint+type SnocMatC :: [Nat] -> Type -> Type -> Constraint class SnocMatC ns a b where   snocMat ::     Iso@@ -2113,45 +2166,45 @@   lastMat :: a ~ b => Lens' (Mat ns a) (ConsMatCTA ns a)   lastMat = snocMat . _Snd -instance {-# OVERLAPPING #-} SnocMatC (1 ':| '[]) a b where+instance {-# OVERLAPPING #-} SnocMatC '[1] a b where   snocMat =     iso       (\m -> (Eof1, V.last (mVec m)))       (\(Eof1, a) -> MatIU (V.singleton a) (_1P :| [])) instance   {-# OVERLAPPABLE #-}-  ( ConsMatCTB (n ':| '[]) a ~ Vec (n GN.- 1) a-  , ConsMatCTB (n ':| '[]) b ~ Vec (n GN.- 1) b+  ( ConsMatCTB '[n] a ~ Vec (n GN.- 1) a+  , ConsMatCTB '[n] b ~ Vec (n GN.- 1) b   ) =>-  SnocMatC (n ':| '[]) a b+  SnocMatC '[n] a b   where   snocMat =     iso       ( \(Mat v0 (sn :| ps)) ->           let n = frp $ predP sn            in case V.unsnoc v0 of-                Nothing -> programmError "snocMat (1 GN.+ n ':| '[]): no data"+                Nothing -> programmError "snocMat '[1 GN.+ n]: no data"                 Just (v, a) -> (MatIU v (n :| ps), a)       )       (\(Mat v (p :| ps), a) -> MatIU (V.snoc v a) (succP p :| ps)) -instance {-# OVERLAPPING #-} SnocMatC (1 ':| n1 ': ns) a b where+instance {-# OVERLAPPING #-} SnocMatC (1 ': n1 ': ns) a b where   snocMat =     iso       ( \(Mat v (_ :| ps)) ->           case ps of             m : ns ->               (EofN, MatIU v (m :| ns))-            [] -> programmError "snocMat (1 GN.+ n ':| '[]): missing indices"+            [] -> programmError "snocMat '[1 GN.+ n]: missing indices"       )       (\(EofN, Mat v ps) -> MatIU v (_1P N.<| ps))  instance   {-# OVERLAPPABLE #-}-  ( ConsMatCTB (n ':| m ': ns) a ~ Mat ((n GN.- 1) ':| m ': ns) a-  , ConsMatCTB (n ':| m ': ns) a ~ Mat ((n GN.- 1) ':| m ': ns) b+  ( ConsMatCTB (n ': m ': ns) a ~ Mat ((n GN.- 1) ': m ': ns) a+  , ConsMatCTB (n ': m ': ns) a ~ Mat ((n GN.- 1) ': m ': ns) b   ) =>-  SnocMatC (n ':| m ': ns) a b+  SnocMatC (n ': m ': ns) a b   where   snocMat =     iso@@ -2165,7 +2218,7 @@                in ( MatIU v2 ps2                   , MatIU v1 ps1                   )-            [] -> programmError "snocMat:(1 GN.+ n ':| m ': ns): missing indices"+            [] -> programmError "snocMat:(1 GN.+ n ': m ': ns): missing indices"       )       (\(Mat v1 (p1 :| ps1), Mat v2 _) -> MatIU (v1 <> v2) (succP p1 :| ps1)) @@ -2173,13 +2226,13 @@ rowsToMat ::   forall x n m ns a.   Vec x (Fin n) ->-  Mat (n ':| m ': ns) a ->-  Mat (x ':| m ': ns) a+  Mat (n ': m ': ns) a ->+  Mat (x ': m ': ns) a rowsToMat w1@(Mat _ (x :| _)) w2@(Mat _ (_ :| ps)) =   MatIU (V.concat $ toListMat $ fmap (\fn -> mVec (indexRow fn w2)) w1) (x :| ps)  -- | get a row from a matrix using a concrete index see '_row''-indexRow :: Fin n -> Mat (n ':| m ': ns) a -> Mat (m ':| ns) a+indexRow :: Fin n -> Mat (n ': m ': ns) a -> Mat (m ': ns) a indexRow (Fin (Pos i) _n) (Mat v (_ :| ps)) =   case ps of     m : ns ->@@ -2221,33 +2274,33 @@ dim2 = id  -- | matrix of dimension 3-dim3 :: Mat (n ':| '[m, p]) a -> Mat (n ':| '[m, p]) a+dim3 :: Mat '[n, m, p] a -> Mat '[n, m, p] a dim3 = id  -- | matrix of dimension 4-dim4 :: Mat (n ':| '[m, p, q]) a -> Mat (n ':| '[m, p, q]) a+dim4 :: Mat '[n, m, p, q] a -> Mat '[n, m, p, q] a dim4 = id  -- | matrix of dimension 5-dim5 :: Mat (n ':| '[m, p, q, r]) a -> Mat (n ':| '[m, p, q, r]) a+dim5 :: Mat '[n, m, p, q, r] a -> Mat '[n, m, p, q, r] a dim5 = id  -- | matrix of dimension 6-dim6 :: Mat (n ':| '[m, p, q, r, s]) a -> Mat (n ':| '[m, p, q, r, s]) a+dim6 :: Mat '[n, m, p, q, r, s] a -> Mat '[n, m, p, q, r, s] a dim6 = id  -- | matrix of dimension 7-dim7 :: Mat (n ':| '[m, p, q, r, s, t]) a -> Mat (n ':| '[m, p, q, r, s, t]) a+dim7 :: Mat '[n, m, p, q, r, s, t] a -> Mat '[n, m, p, q, r, s, t] a dim7 = id  -- | matrix of dimension 8-dim8 :: Mat (n ':| '[m, p, q, r, s, t, u]) a -> Mat (n ':| '[m, p, q, r, s, t, u]) a+dim8 :: Mat '[n, m, p, q, r, s, t, u] a -> Mat '[n, m, p, q, r, s, t, u] a dim8 = id  -- | matrix of dimension 9-dim9 :: Mat (n ':| '[m, p, q, r, s, t, u, v]) a -> Mat (n ':| '[m, p, q, r, s, t, u, v]) a+dim9 :: Mat '[n, m, p, q, r, s, t, u, v] a -> Mat '[n, m, p, q, r, s, t, u, v] a dim9 = id  -- | matrix of dimension 10-dim10 :: Mat (n ':| '[m, p, q, r, s, t, u, v, w]) a -> Mat (n ':| '[m, p, q, r, s, t, u, v, w]) a+dim10 :: Mat '[n, m, p, q, r, s, t, u, v, w] a -> Mat '[n, m, p, q, r, s, t, u, v, w] a dim10 = id
src/Cybus/NatHelper.hs view
@@ -48,11 +48,10 @@   D10,    -- * matrix helpers-  NS,-  Product1T,+  ProductT,   NN,   NN',-  Reverse1T,+  ReverseT,   ListTupleT,    -- * list and nonempty conversions@@ -82,7 +81,7 @@ import Primus.List import Primus.NonEmpty import Primus.One-import qualified Primus.TypeLevel as TP (Cons1T, FailUnless)+import qualified Primus.TypeLevel as TP (FailUnless)  -- | get the factorial of a 'Nat' type FacT :: Nat -> Nat@@ -142,29 +141,23 @@ type DiffT :: Nat -> Nat -> Nat -> Nat type DiffT i j n = j GN.+ 1 GN.- i --- | product of a type level nonempty list as a 'Nat'-type Product1T :: NonEmpty Nat -> Nat-type family Product1T ns where-  Product1T (n ':| '[]) = n-  Product1T (n ':| n1 ': ns) = n GN.* Product1T (n1 ':| ns)---- | convert a list of 'Nat' into a nonempty list of 'Nat'-type NS :: [Nat] -> NonEmpty Nat-type family NS ns where-  NS '[] = GL.TypeError ( 'GL.Text "NS: must have at least one Nat value for NonEmpty Nat")-  NS (n ': '[]) = n ':| '[]-  NS (n ': m ': ns) = TP.Cons1T n (NS (m ': ns))+-- | reverse a type level list+type ReverseT :: forall k. [k] -> [k]+type family ReverseT ns where+  ReverseT (n ': ns) = ReverseT' (n ': ns) '[] --- | used for reversing the indices of a matrix using type level list of nonempty indices-type Reverse1T :: forall k. NonEmpty k -> NonEmpty k-type family Reverse1T ns where-  Reverse1T (n ':| ns) = Reverse1T' (n ': ns) '[]+-- | used by 'ReverseT'+type ReverseT' :: forall k. [k] -> [k] -> [k]+type family ReverseT' ns ret where+  ReverseT' '[] (r ': rs) = r ': rs+  ReverseT' (n ': ns) ret = ReverseT' ns (n ': ret) --- | used by 'Reverse1T'-type Reverse1T' :: forall k. [k] -> [k] -> NonEmpty k-type family Reverse1T' ns ret where-  Reverse1T' '[] (r ': rs) = r ':| rs-  Reverse1T' (n ': ns) ret = Reverse1T' ns (n ': ret)+-- | product of a type level list as a 'Nat'+type ProductT :: [Nat] -> Nat+type family ProductT ns where+  ProductT '[] = GL.TypeError ('GL.Text "ProductT: empty indices")+  ProductT '[n] = n+  ProductT (n ': n1 ': ns) = n GN.* ProductT (n1 ': ns)  -- | extracts the dimensions of a nested list type ValidateNestedListT :: Type -> Peano@@ -245,16 +238,18 @@   PeanoToNatT ( 'S n) = 1 GN.+ PeanoToNatT n  -- | convert a matrix index into nested lists-type ListNST :: NonEmpty Nat -> Type -> Type+type ListNST :: [Nat] -> Type -> Type type family ListNST ns a where-  ListNST (_ ':| '[]) a = [a]-  ListNST (_ ':| n1 ': ns) a = [ListNST (n1 ':| ns) a]+  ListNST '[] _ = GL.TypeError ('GL.Text "ListNST: empty indices")+  ListNST '[_] a = [a]+  ListNST (_ ': n1 ': ns) a = [ListNST (n1 ': ns) a]  -- | convert a matrix index into nested lists-type NonEmptyNST :: NonEmpty Nat -> Type -> Type+type NonEmptyNST :: [Nat] -> Type -> Type type family NonEmptyNST ns a where-  NonEmptyNST (_ ':| '[]) a = NonEmpty a-  NonEmptyNST (_ ':| n1 ': ns) a = NonEmpty (NonEmptyNST (n1 ':| ns) a)+  NonEmptyNST '[] _ = GL.TypeError ('GL.Text "NonEmptyNST: empty indices")+  NonEmptyNST '[_] a = NonEmpty a+  NonEmptyNST (_ ': n1 ': ns) a = NonEmpty (NonEmptyNST (n1 ': ns) a)  -- | convert a nested nonempty list into a nested list nestedNonEmptyToList :: forall ns a. NestedListC ns => NonEmptyNST ns a -> Either String (ListNST ns a)@@ -265,7 +260,7 @@ nestedListToNonEmpty = nestedListToNonEmptyC @ns @_ @a Proxy  -- | methods for working with nested lists-type NestedListC :: NonEmpty Nat -> Constraint+type NestedListC :: [Nat] -> Constraint class NestedListC ns where   -- | convert a nested list to a nested nonempty list   nestedListToNonEmptyC :: proxy a -> ListNST ns a -> Either String (NonEmptyNST ns a)@@ -275,7 +270,12 @@    flattenNestedListC :: proxy a -> ListNST ns a -> Either String [a] -instance PosT n => NestedListC (n ':| '[]) where+instance GL.TypeError ('GL.Text "NestedListC '[]: empty indices") => NestedListC '[] where+  nestedListToNonEmptyC = compileError "NestedListC '[]:nestedListToNonEmptyC"+  nestedNonEmptyToListC = compileError "NestedListC '[]:nestedNonEmptyToListC"+  flattenNestedListC = compileError "NestedListC '[]:flattenNestedListC"++instance PosT n => NestedListC '[n] where   nestedListToNonEmptyC _ = \case     [] -> Left "nestedListToNonEmptyC 'SZ no data"     x : xs -> lmsg "nestedListToNonEmptyC 'SZ" $ lengthExact1 (fromNP @n) (x :| xs)@@ -284,20 +284,20 @@     [] -> Left "flattenNestedListC 'SZ no data"     x : xs -> lmsg "flattenNestedListC 'SZ" $ lengthExact (fromN @n) (x : xs) -instance (PosT n, NestedListC (n1 ':| ns)) => NestedListC (n ':| n1 ': ns) where+instance (PosT n, NestedListC (n1 ': ns)) => NestedListC (n ': n1 ': ns) where   nestedListToNonEmptyC p = \case     [] -> Left "nestedListToNonEmptyC 'SS no data"     x : xs -> do       ys <- lmsg "nestedListToNonEmptyC 'SS" $ lengthExact1 (fromNP @n) (x :| xs)-      traverse (nestedListToNonEmptyC @(n1 ':| ns) p) ys+      traverse (nestedListToNonEmptyC @(n1 ': ns) p) ys   nestedNonEmptyToListC p lst = do     xs <- lmsg "nestedNonEmptyToListC 'SS" $ lengthExact1 (fromNP @n) lst-    N.toList <$> traverse (nestedNonEmptyToListC @(n1 ':| ns) p) xs+    N.toList <$> traverse (nestedNonEmptyToListC @(n1 ': ns) p) xs   flattenNestedListC p = \case     [] -> Left "flattenNestedListC 'SS no data"     x : xs -> do       ys <- lmsg "flattenNestedListC 'SS" $ lengthExact (fromN @n) (x : xs)-      concat <$> traverse (flattenNestedListC @(n1 ':| ns) p) ys+      concat <$> traverse (flattenNestedListC @(n1 ': ns) p) ys  -- mapM_ (putStrLn . genListTupleT) [2..20]  -- to generate from two onwards @@ -325,9 +325,9 @@   ListTupleT 19 a = (a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a)   ListTupleT 20 a = (a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a) --- | generates a nonempty list of indices using each digit of the given 'Nat'-type NN :: Nat -> NonEmpty Nat-type NN n = NS (NN' '[] n)+-- | generates a list of indices using each digit of the given 'Nat'+type NN :: Nat -> [Nat]+type NN n = NN' '[] n  -- | generates a list of indices using the individual digits of the given 'Nat' type NN' :: [Nat] -> Nat -> [Nat]@@ -336,41 +336,41 @@   NN' ns n = NN' (GN.Mod n 10 ': ns) (GN.Div n 10)  -- | matrix dimension of degree 1-type D1 :: Nat -> NonEmpty Nat-type D1 a = a ':| '[]+type D1 :: Nat -> [Nat]+type D1 a = '[a]  -- | matrix dimension of degree 2-type D2 :: Nat -> Nat -> NonEmpty Nat-type D2 a b = a ':| '[b]+type D2 :: Nat -> Nat -> [Nat]+type D2 a b = '[a, b]  -- | matrix dimension of degree 3-type D3 :: Nat -> Nat -> Nat -> NonEmpty Nat-type D3 a b c = a ':| '[b, c]+type D3 :: Nat -> Nat -> Nat -> [Nat]+type D3 a b c = '[a, b, c]  -- | matrix dimension of degree 4-type D4 :: Nat -> Nat -> Nat -> Nat -> NonEmpty Nat-type D4 a b c d = a ':| '[b, c, d]+type D4 :: Nat -> Nat -> Nat -> Nat -> [Nat]+type D4 a b c d = '[a, b, c, d]  -- | matrix dimension of degree 5-type D5 :: Nat -> Nat -> Nat -> Nat -> Nat -> NonEmpty Nat-type D5 a b c d e = a ':| '[b, c, d, e]+type D5 :: Nat -> Nat -> Nat -> Nat -> Nat -> [Nat]+type D5 a b c d e = '[a, b, c, d, e]  -- | matrix dimension of degree 6-type D6 :: Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> NonEmpty Nat-type D6 a b c d e f = a ':| '[b, c, d, e, f]+type D6 :: Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> [Nat]+type D6 a b c d e f = '[a, b, c, d, e, f]  -- | matrix dimension of degree 7-type D7 :: Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> NonEmpty Nat-type D7 a b c d e f g = a ':| '[b, c, d, e, f, g]+type D7 :: Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> [Nat]+type D7 a b c d e f g = '[a, b, c, d, e, f, g]  -- | matrix dimension of degree 8-type D8 :: Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> NonEmpty Nat-type D8 a b c d e f g h = a ':| '[b, c, d, e, f, g, h]+type D8 :: Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> [Nat]+type D8 a b c d e f g h = '[a, b, c, d, e, f, g, h]  -- | matrix dimension of degree 9-type D9 :: Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> NonEmpty Nat-type D9 a b c d e f g h i = a ':| '[b, c, d, e, f, g, h, i]+type D9 :: Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> [Nat]+type D9 a b c d e f g h i = '[a, b, c, d, e, f, g, h, i]  -- | matrix dimension of degree 10-type D10 :: Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> NonEmpty Nat-type D10 a b c d e f g h i j = a ':| '[b, c, d, e, f, g, h, i, j]+type D10 :: Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> Nat -> [Nat]+type D10 a b c d e f g h i j = '[a, b, c, d, e, f, g, h, i, j]
test/TestEnum.hs view
@@ -3,7 +3,6 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-}-{-# LANGUAGE TypeOperators #-}  module TestEnum where @@ -28,12 +27,12 @@     "TestEnum"     [ testCase "toEnum" $         toEnum @(Mat2 3 4 ()) 0-          @?= mat' @(NS '[3, 4]) (replicate 12 ())+          @?= mat' @'[3, 4] (replicate 12 ())     , testCase "toEnum" $-        toEnum @(Mat (NS '[2, 3]) ()) 0-          @?= mat' @(NS '[2, 3]) [(), (), (), (), (), ()]+        toEnum @(Mat '[2, 3] ()) 0+          @?= mat' @'[2, 3] [(), (), (), (), (), ()]     , testCase "toEnum" $-        left (const ()) (toEnumRep @(Mat (NS '[2, 3])) @() 2)+        left (const ()) (toEnumRep @(Mat '[2, 3]) @() 2)           @?= Left ()     , testCase "toenum" $         toEnum @(Fin 10) 0@@ -54,31 +53,31 @@         maxBound @(Fin 5)           @?= FinU _5P _5P     , testCase "toEnumList" $-        toEnumList @(FinMat (NS '[3, 4])) (-2)+        toEnumList @(FinMat '[3, 4]) (-2)           @?= Left "calcNextEnum:not defined for negative numbers"     , testCase "toEnumList" $-        toEnumList @(FinMat (NS '[3, 4])) (-1)+        toEnumList @(FinMat '[3, 4]) (-1)           @?= Left "calcNextEnum:not defined for negative numbers"     , testCase "toEnumList" $-        toEnumList @(FinMat (NS '[3, 4])) 0+        toEnumList @(FinMat '[3, 4]) 0           @?= Right []     , testCase "toEnumList" $-        toEnumList @(FinMat (NS '[3, 4])) 1+        toEnumList @(FinMat '[3, 4]) 1           @?= Right [FinMatU 1 (_3P :| [_4P])]     , testCase "toEnumList" $-        toEnumList @(FinMat (NS '[3, 4])) 4+        toEnumList @(FinMat '[3, 4]) 4           @?= Right [FinMatU 4 (_3P :| [_4P])]     , testCase "toEnumList" $-        toEnumList @(FinMat (NS '[3, 4])) 5+        toEnumList @(FinMat '[3, 4]) 5           @?= Right [FinMatU 5 (_3P :| [_4P])]     , testCase "toEnumList" $-        toEnumList @(FinMat (NS '[1, 1, 1, 1])) (-2)+        toEnumList @(FinMat '[1, 1, 1, 1]) (-2)           @?= Left "calcNextEnum:not defined for negative numbers"     , testCase "toEnumList" $-        toEnumList @(FinMat (NS '[1, 1, 1, 1])) 0+        toEnumList @(FinMat '[1, 1, 1, 1]) 0           @?= Right []     , testCase "toEnumList" $-        toEnumList @(FinMat (NS '[1, 1, 1, 1])) 2+        toEnumList @(FinMat '[1, 1, 1, 1]) 2           @?= Left "calcNextEnum:not defined for positive numbers"     , testCase "toEnumList" $         toEnumList @(Fin 1) (-1)@@ -118,35 +117,35 @@         iterateT1 predSafe (FinU @5 _1P _5P)           @?= FinU _1P _5P :| []     , testCase "toEnumRep" $-        toEnumRep @(Mat (NS '[4])) @Ordering 10-          @?= Right (mat' @(NS '[4]) [LT, EQ, LT, EQ])+        toEnumRep @(Mat '[4]) @Ordering 10+          @?= Right (mat' @'[4] [LT, EQ, LT, EQ])     , testCase "toEnumRep" $-        toEnumRep @(Mat (NS '[4])) @Ordering 0-          @?= Right (mat' @(NS '[4]) [LT, LT, LT, LT])+        toEnumRep @(Mat '[4]) @Ordering 0+          @?= Right (mat' @'[4] [LT, LT, LT, LT])     , testCase "toEnumList" $         toEnumList @(Vec 3 Ordering) 0           @?= Right []     , testCase "toEnumList" $         toEnumList @(Vec 3 Ordering) 1-          @?= Right [mat' @(NS '[3]) [LT, LT, EQ]]+          @?= Right [mat' @'[3] [LT, LT, EQ]]     , testCase "toEnumList" $         toEnumList @(Vec 3 Ordering) 200-          @?= Right [mat' @(NS '[3]) [LT, GT, EQ], mat' @(NS '[3]) [EQ, LT, GT]]+          @?= Right [mat' @'[3] [LT, GT, EQ], mat' @'[3] [EQ, LT, GT]]     , testCase "toEnumList1" $         toEnumList1 @(Vec 3 Ordering) 0-          @?= Right (mat' @(NS '[3]) [LT, LT, LT] :| [])+          @?= Right (mat' @'[3] [LT, LT, LT] :| [])     , testCase "toEnumList1" $         toEnumList1 @(Vec 3 Ordering) 1-          @?= Right (mat' @(NS '[3]) [LT, LT, EQ] :| [])+          @?= Right (mat' @'[3] [LT, LT, EQ] :| [])     , testCase "toEnumList1" $         toEnumList1 @(Vec 3 Ordering) 26-          @?= Right (mat' @(NS '[3]) [GT, GT, GT] :| [])+          @?= Right (mat' @'[3] [GT, GT, GT] :| [])     , testCase "toEnumList1" $         toEnumList1 @(Vec 3 Ordering) 27-          @?= Right (mat' @(NS '[3]) [LT, LT, EQ] :| [mat' @(NS '[3]) [LT, LT, LT]])+          @?= Right (mat' @'[3] [LT, LT, EQ] :| [mat' @'[3] [LT, LT, LT]])     , testCase "toEnumList1" $         toEnumList1 @(Vec 3 Ordering) 200-          @?= Right (mat' @(NS '[3]) [LT, GT, EQ] :| [mat' @(NS '[3]) [EQ, LT, GT]])+          @?= Right (mat' @'[3] [LT, GT, EQ] :| [mat' @'[3] [EQ, LT, GT]])     , testCase "succTraversable" $         universe1 @(Vec 3 Ordering)           @?= iterateT1 succSafe minBound@@ -166,10 +165,10 @@         toEnumList1 @(Vec 3 Bool) 20           @?= Right ((False .: True .| False) :| [True .: False .| False])     , testCase "toEnumTraversable" $-        toEnumTraversable @Ordering (pure @(Mat (NS '[6])) ()) 10+        toEnumTraversable @Ordering (pure @(Mat '[6]) ()) 10           @?= Right (LT .: LT .: LT .: EQ .: LT .| EQ)     , testCase "toEnumRep" $-        toEnumRep @(Mat (NS '[6])) @Ordering 10+        toEnumRep @(Mat '[6]) @Ordering 10           @?= Right (LT .: LT .: LT .: EQ .: LT .| EQ)     , testCase "universe1" $         universe1 @(FinMat (NN 123))@@ -183,20 +182,20 @@           @?= let ff p n = FinU @5 p n                in Right ([ff _1P _5P, ff _1P _5P] :| [[ff _1P _5P, ff _2P _5P], [ff _1P _5P, ff _3P _5P], [ff _1P _5P, ff _4P _5P], [ff _1P _5P, ff _5P _5P], [ff _2P _5P, ff _1P _5P], [ff _2P _5P, ff _2P _5P], [ff _2P _5P, ff _3P _5P], [ff _2P _5P, ff _4P _5P], [ff _2P _5P, ff _5P _5P], [ff _3P _5P, ff _1P _5P], [ff _3P _5P, ff _2P _5P], [ff _3P _5P, ff _3P _5P], [ff _3P _5P, ff _4P _5P], [ff _3P _5P, ff _5P _5P], [ff _4P _5P, ff _1P _5P], [ff _4P _5P, ff _2P _5P], [ff _4P _5P, ff _3P _5P], [ff _4P _5P, ff _4P _5P], [ff _4P _5P, ff _5P _5P], [ff _5P _5P, ff _1P _5P], [ff _5P _5P, ff _2P _5P], [ff _5P _5P, ff _3P _5P], [ff _5P _5P, ff _4P _5P], [ff _5P _5P, ff _5P _5P]])     , testCase "universeTraversable" $-        universeTraversable (vec @2 (repeat (finMatC @(1 ':| '[1]) @(2 ':| '[3]))))+        universeTraversable (vec @2 (repeat (finMatC @'[1, 1] @'[2, 3])))           @?= let ff i = FinMatU i (_2P :| [_3P])                in Right ((ff 0 .| ff 0) :| [ff 0 .| ff 1, ff 0 .| ff 2, ff 0 .| ff 3, ff 0 .| ff 4, ff 0 .| ff 5, ff 1 .| ff 0, ff 1 .| ff 1, ff 1 .| ff 2, ff 1 .| ff 3, ff 1 .| ff 4, ff 1 .| ff 5, ff 2 .| ff 0, ff 2 .| ff 1, ff 2 .| ff 2, ff 2 .| ff 3, ff 2 .| ff 4, ff 2 .| ff 5, ff 3 .| ff 0, ff 3 .| ff 1, ff 3 .| ff 2, ff 3 .| ff 3, ff 3 .| ff 4, ff 3 .| ff 5, ff 4 .| ff 0, ff 4 .| ff 1, ff 4 .| ff 2, ff 4 .| ff 3, ff 4 .| ff 4, ff 4 .| ff 5, ff 5 .| ff 0, ff 5 .| ff 1, ff 5 .| ff 2, ff 5 .| ff 3, ff 5 .| ff 4, ff 5 .| ff 5])     , testCase "capacity" $-        capacity @(FinMat (2 ':| '[3])) (replicate 2 ())+        capacity @(FinMat '[2, 3]) (replicate 2 ())           @?= Right (0, 35)     , testCase "capacity" $-        capacity @(FinMat (1 ':| '[3, 5, 6])) (replicate 7 ())+        capacity @(FinMat '[1, 3, 5, 6]) (replicate 7 ())           @?= Right (0, 47829689999999)     , testCase "iterateT1 succTraversable FinMat" $-        fmap (toList . fmap fmPos) (iterateT1 succTraversable (vec' @2 [finMatC @(NS '[3, 3]) @(NS '[4, 3]), finMatC @(NS '[2, 1]) @(NS '[4, 3])]))+        fmap (toList . fmap fmPos) (iterateT1 succTraversable (vec' @2 [finMatC @'[3, 3] @'[4, 3], finMatC @'[2, 1] @'[4, 3]]))           @?= [8, 3] :| [[8, 4], [8, 5], [8, 6], [8, 7], [8, 8], [8, 9], [8, 10], [8, 11], [9, 0], [9, 1], [9, 2], [9, 3], [9, 4], [9, 5], [9, 6], [9, 7], [9, 8], [9, 9], [9, 10], [9, 11], [10, 0], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 6], [10, 7], [10, 8], [10, 9], [10, 10], [10, 11], [11, 0], [11, 1], [11, 2], [11, 3], [11, 4], [11, 5], [11, 6], [11, 7], [11, 8], [11, 9], [11, 10], [11, 11]]     , testCase "iterateT1 succTraversable FinMat" $-        fmap (toList . fmap fmPos) (iterateT1 succTraversable [finMatC @(NS '[3, 3]) @(NS '[3, 3]), finMatC @(NS '[2, 1]), finMatC @(NS '[3, 1])])+        fmap (toList . fmap fmPos) (iterateT1 succTraversable [finMatC @'[3, 3] @'[3, 3], finMatC @'[2, 1], finMatC @'[3, 1]])           @?= [8, 3, 6] :| [[8, 3, 7], [8, 3, 8], [8, 4, 0], [8, 4, 1], [8, 4, 2], [8, 4, 3], [8, 4, 4], [8, 4, 5], [8, 4, 6], [8, 4, 7], [8, 4, 8], [8, 5, 0], [8, 5, 1], [8, 5, 2], [8, 5, 3], [8, 5, 4], [8, 5, 5], [8, 5, 6], [8, 5, 7], [8, 5, 8], [8, 6, 0], [8, 6, 1], [8, 6, 2], [8, 6, 3], [8, 6, 4], [8, 6, 5], [8, 6, 6], [8, 6, 7], [8, 6, 8], [8, 7, 0], [8, 7, 1], [8, 7, 2], [8, 7, 3], [8, 7, 4], [8, 7, 5], [8, 7, 6], [8, 7, 7], [8, 7, 8], [8, 8, 0], [8, 8, 1], [8, 8, 2], [8, 8, 3], [8, 8, 4], [8, 8, 5], [8, 8, 6], [8, 8, 7], [8, 8, 8]]     , testCase "iterateT1 succTraversable Fin" $         fmap (toList . fmap fnPos) (iterateT1 succTraversable [finC @4 @5, finC @3, finC @2])
test/TestFinMat.hs view
@@ -5,7 +5,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-}-{-# LANGUAGE TypeOperators #-}  module TestFinMat where @@ -34,146 +33,146 @@   testGroup     "TestFinMat"     [ testCase "succSafe universe" $-        universe1 @(FinMat (NS '[2, 3, 4]))+        universe1 @(FinMat '[2, 3, 4])           @?= iterateT1 succSafe minBound     , testCase "predSafe universe" $-        universe1 @(FinMat (NS '[2, 3, 4]))+        universe1 @(FinMat '[2, 3, 4])           @?= N.reverse (iterateT1 predSafe maxBound)     , testCase "next finMat" $-        succSafe (maxBound :: FinMat (3 ':| '[4, 5, 3]))+        succSafe (maxBound :: FinMat '[3, 4, 5, 3])           @?= Nothing     , testCase "prev finMat" $-        predSafe (minBound :: FinMat (3 ':| '[4, 5, 3]))+        predSafe (minBound :: FinMat '[3, 4, 5, 3])           @?= Nothing     , testCase "universe enums" $-        universe1 @(FinMat (NS '[2, 3, 4]))+        universe1 @(FinMat '[2, 3, 4])           @?= iterateT1 succSafe minBound     , testCase "prev FinMat universe" $-        universe1 @(FinMat (NS '[2, 3, 4]))+        universe1 @(FinMat '[2, 3, 4])           @?= N.reverse (iterateT1 predSafe maxBound)     , testCase "minBound" $-        (minBound :: FinMat (3 ':| '[4, 5, 1]))+        (minBound :: FinMat '[3, 4, 5, 1])           @?= FinMatU 0 (_3P :| [_4P, _5P, _1P])     , testCase "maxBound" $-        (maxBound :: FinMat (3 ':| '[4, 5, 1]))+        (maxBound :: FinMat '[3, 4, 5, 1])           @?= FinMatU 59 (_3P :| [_4P, _5P, _1P])     , testCase "maxBound" $-        fromPositives (finMatToNonEmpty (maxBound :: FinMat (3 ':| '[4, 5, 1])))+        fromPositives (finMatToNonEmpty (maxBound :: FinMat '[3, 4, 5, 1]))           @?= [3, 4, 5, 1]     , testCase "prev finMat" $-        fmap (fromPositives . finMatToNonEmpty) (predSafe (maxBound :: FinMat (3 ':| '[4, 5, 1])))+        fmap (fromPositives . finMatToNonEmpty) (predSafe (maxBound :: FinMat '[3, 4, 5, 1]))           @?= Just [3, 4, 4, 1]     , testCase "prev finMat" $-        fmap (fromPositives . finMatToNonEmpty) (predSafe (maxBound :: FinMat (3 ':| '[4, 5, 3])))+        fmap (fromPositives . finMatToNonEmpty) (predSafe (maxBound :: FinMat '[3, 4, 5, 3]))           @?= Just [3, 4, 5, 2]     , testCase "next finMat" $-        succSafe (maxBound :: FinMat (3 ':| '[4, 5, 3]))+        succSafe (maxBound :: FinMat '[3, 4, 5, 3])           @?= Nothing     , testCase "prev finMat" $-        predSafe (minBound :: FinMat (3 ':| '[4, 5, 3]))+        predSafe (minBound :: FinMat '[3, 4, 5, 3])           @?= Nothing     , testCase "next5 finMat" $-        fmap (fromPositives . finMatToNonEmpty) (take1 _5P $ enumFrom1 (fr $ nonEmptyToFinMat (_2P :| [_3P, _4P]) :: FinMat (3 ':| '[4, 5])))+        fmap (fromPositives . finMatToNonEmpty) (take1 _5P $ enumFrom1 (fr $ nonEmptyToFinMat (_2P :| [_3P, _4P]) :: FinMat '[3, 4, 5]))           @?= [2, 3, 4] :| [[2, 3, 5], [2, 4, 1], [2, 4, 2], [2, 4, 3]]     , testCase "prev5 finMat" $-        fmap (fromPositives . finMatToNonEmpty) (take1 _5P $ enumFrom1R (fr $ nonEmptyToFinMat (_2P :| [_3P, _4P]) :: FinMat (3 ':| '[4, 5])))+        fmap (fromPositives . finMatToNonEmpty) (take1 _5P $ enumFrom1R (fr $ nonEmptyToFinMat (_2P :| [_3P, _4P]) :: FinMat '[3, 4, 5]))           @?= [2, 3, 4] :| [[2, 3, 3], [2, 3, 2], [2, 3, 1], [2, 2, 5]]     , testCase "universe1 enum" $-        universe1 @(FinMat (NS '[2, 3, 7]))+        universe1 @(FinMat '[2, 3, 7])           @?= fmi237'     , testCase "universe1 enum" $-        universe1 @(FinMat (NS '[1, 3, 5, 7, 2, 1]))+        universe1 @(FinMat '[1, 3, 5, 7, 2, 1])           @?= fmiNS'     , testCase "toEnum" $         N.map toEnum (0 :| [1 .. 41])           @?= fmi237'     , testCase "mkFinMatC fail" $-        mkFinMatC @(NS '[2, 3, 7]) 42 (_2P :| [_3P, _7P])+        mkFinMatC @'[2, 3, 7] 42 (_2P :| [_3P, _7P])           @?= Left "mkFinMat:is too large: maximum is 41 but found 42"     , testCase "mkFinMatC fail" $-        mkFinMatC @(NS '[2, 3, 7]) (-1) (_2P :| [_3P, _7P])+        mkFinMatC @'[2, 3, 7] (-1) (_2P :| [_3P, _7P])           @?= Left "mkFinMat:cant be less than 0: i=-1"     , testCase "mkFinMatC" $-        mkFinMatC @(NS '[2, 3, 7]) 41 (_2P :| [_3P, _7P])+        mkFinMatC @'[2, 3, 7] 41 (_2P :| [_3P, _7P])           @?= Right maxBound     , testCase "mkFinMatC" $-        mkFinMatC @(NS '[2, 3, 7]) 41 (_2P :| [_3P, _7P])-          @?= Right (FinMatU @(NS '[2, 3, 7]) 41 (_2P :| [_3P, _7P]))+        mkFinMatC @'[2, 3, 7] 41 (_2P :| [_3P, _7P])+          @?= Right (FinMatU @'[2, 3, 7] 41 (_2P :| [_3P, _7P]))     , testCase "mkFinMatC" $-        mkFinMatC @(NS '[2, 3, 7]) 0 (_2P :| [_3P, _7P])+        mkFinMatC @'[2, 3, 7] 0 (_2P :| [_3P, _7P])           @?= Right minBound     , testCase "mkFinMatC" $-        mkFinMatC @(NS '[2, 3, 7]) 0 (_2P :| [_3P, _7P])-          @?= Right (FinMatU @(NS '[2, 3, 7]) 0 (_2P :| [_3P, _7P]))+        mkFinMatC @'[2, 3, 7] 0 (_2P :| [_3P, _7P])+          @?= Right (FinMatU @'[2, 3, 7] 0 (_2P :| [_3P, _7P]))     , testCase "mkFinMatC" $-        mkFinMatC @(NS '[2, 3, 7]) 17 (_2P :| [_3P, _7P])-          @?= Right (FinMatU @(NS '[2, 3, 7]) 17 (_2P :| [_3P, _7P]))+        mkFinMatC @'[2, 3, 7] 17 (_2P :| [_3P, _7P])+          @?= Right (FinMatU @'[2, 3, 7] 17 (_2P :| [_3P, _7P]))     , testCase "nonEmptyToFinMat" $-        nonEmptyToFinMat @(NS '[2, 3, 7]) (_1P :| [_3P, _4P])+        nonEmptyToFinMat @'[2, 3, 7] (_1P :| [_3P, _4P])           @?= Right (FinMatU 17 (_2P :| [_3P, _7P]))     , testCase "nonEmptyToFinMat" $-        nonEmptyToFinMat' @(NS '[2, 3, 7]) (_1P :| [_3P, _4P]) (_2P :| [_3P, _7P])+        nonEmptyToFinMat' @'[2, 3, 7] (_1P :| [_3P, _4P]) (_2P :| [_3P, _7P])           @?= Right (FinMatU 17 (_2P :| [_3P, _7P]))     , testCase "pos" $-        finMatC @(NS '[3, 1]) @(NS '[3, 4])+        finMatC @'[3, 1] @'[3, 4]           @?= FinMatU 8 (_3P :| [_4P])     , testCase "pos" $-        finMatC @(NS '[1, 1, 1, 1]) @(NS '[1, 2, 3, 4])+        finMatC @'[1, 1, 1, 1] @'[1, 2, 3, 4]           @?= FinMatU 0 (_1P :| [_2P, _3P, _4P])     , testCase "pos" $-        finMatC @(NS '[3, 3, 3]) @(NS '[4, 4, 4])+        finMatC @'[3, 3, 3] @'[4, 4, 4]           @?= FinMatU 42 (_4P :| [_4P, _4P])     , testCase "finMatC" $-        finMatToNonEmpty (finMatC @(NS '[1, 3, 4]) @(NS '[2, 3, 7]))+        finMatToNonEmpty (finMatC @'[1, 3, 4] @'[2, 3, 7])           @?= _1P :| [_3P, _4P]     , testCase "finMatC" $-        finMatC @(NS '[1, 3, 4]) @(NS '[2, 3, 7])+        finMatC @'[1, 3, 4] @'[2, 3, 7]           @?= FinMatU 17 (_2P :| [_3P, _7P])     , testCase "finMatC" $-        (finMatC @(NS '[1, 3, 4]) @(NS '[2, 3, 7]) ^. _i1)+        (finMatC @'[1, 3, 4] @'[2, 3, 7] ^. _i1)           @?= finC @1 @2     , testCase "finMatC" $-        (finMatC @(NS '[1, 3, 4]) @(NS '[2, 3, 7]) ^. _i2)+        (finMatC @'[1, 3, 4] @'[2, 3, 7] ^. _i2)           @?= finC @3 @3     , testCase "finMatC" $-        (finMatC @(NS '[1, 3, 4]) @(NS '[2, 3, 7]) ^. _i3)+        (finMatC @'[1, 3, 4] @'[2, 3, 7] ^. _i3)           @?= finC @4 @7     , testCase "fromEnum" $         N.map fromEnum fmi237'           @?= 0 :| [1 .. 41]     , testCase "toEnum one" $         toEnum 1-          @?= FinMatU @(NS '[2, 3, 7]) 1 (_2P :| [_3P, _7P])+          @?= FinMatU @'[2, 3, 7] 1 (_2P :| [_3P, _7P])     , testCase "fromEnum one" $-        fromEnum @(FinMat (NS '[2, 3, 4])) (FinMatU 4 (_2P :| [_3P, _4P]))+        fromEnum @(FinMat '[2, 3, 4]) (FinMatU 4 (_2P :| [_3P, _4P]))           @?= 4     , testCase "toEnum one" $-        (toEnum 1 :: FinMat (NS '[2, 3, 7]))+        (toEnum 1 :: FinMat '[2, 3, 7])           @?= FinMatU 1 (_2P :| [_3P, _7P])     , testCase "fromEnum one" $-        fromEnum (FinMatU 7 (_2P :| [_3P, _7P]) :: FinMat (NS '[2, 3, 7]))+        fromEnum (FinMatU 7 (_2P :| [_3P, _7P]) :: FinMat '[2, 3, 7])           @?= 7     , testCase "minbound" $-        minBound @(FinMat (NS '[2, 3, 4]))+        minBound @(FinMat '[2, 3, 4])           @?= FinMatU 0 (_2P :| [_3P, _4P])     , testCase "enum" $-        finMatToNonEmpty (fr $ nonEmptyToFinMat @(NS '[2, 3, 4, 5]) (_1P :| [_3P, _4P, _5P]))+        finMatToNonEmpty (fr $ nonEmptyToFinMat @'[2, 3, 4, 5] (_1P :| [_3P, _4P, _5P]))           @?= _1P :| [_3P, _4P, _5P]     , testCase "succ" $-        finMatToNonEmpty (succ (fr $ nonEmptyToFinMat @(NS '[2, 3, 4, 5]) (_1P :| [_3P, _4P, _5P])))+        finMatToNonEmpty (succ (fr $ nonEmptyToFinMat @'[2, 3, 4, 5] (_1P :| [_3P, _4P, _5P])))           @?= _2P :| [_1P, _1P, _1P]     , testCase "pred" $-        finMatToNonEmpty (pred (fr $ nonEmptyToFinMat @(NS '[2, 3, 4, 5]) (_1P :| [_3P, _4P, _5P])))+        finMatToNonEmpty (pred (fr $ nonEmptyToFinMat @'[2, 3, 4, 5] (_1P :| [_3P, _4P, _5P])))           @?= _1P :| [_3P, _4P, _4P]     , testCase "mkFinMatC" $-        let (xs, ys) = partitionEithers $ map (\i -> mkFinMatC @(NS '[2, 4, 2, 4]) i (_2P :| [_4P, _2P, _4P])) [-10 .. 100]+        let (xs, ys) = partitionEithers $ map (\i -> mkFinMatC @'[2, 4, 2, 4] i (_2P :| [_4P, _2P, _4P])) [-10 .. 100]          in (length xs, length ys, length (groupByAdjacent1 (<) (N.fromList ys)))               @?= (47, 64, 1)     , testCase "maxBound" $-        (maxBound :: FinMat (NS '[2, 3, 6]))+        (maxBound :: FinMat '[2, 3, 6])           @?= FinMatU 35 (_2P :| [_3P, _6P])     , testCase "minBound" $-        (minBound :: FinMat (NS '[2, 3, 6]))+        (minBound :: FinMat '[2, 3, 6])           @?= FinMatU 0 (_2P :| [_3P, _6P])     , testCase "iterateT1 next" $         iterateT1 succSafe minBound@@ -183,38 +182,38 @@           @?= N.reverse fmi237'     , testCase "iterateT1 next" $         iterateT1 succSafe minBound-          @?= fmiNS' @(NS '[1, 3, 5, 7, 3, 2])+          @?= fmiNS' @'[1, 3, 5, 7, 3, 2]     , testCase "fmiNS" $         fmiNS'           @?= fmi237'     , testCase "enumFrom" $-        [minBound :: FinMat (NS '[2, 3]) ..]+        [minBound :: FinMat '[2, 3] ..]           @?= map (`FinMatU` (_2P :| [_3P])) [0 .. 5]     , testCase "_i2 view" $-        (mkFinMatC @(NS '[2, 3, 4]) 10 (_2P :| [_3P, _4P]) ^. _Right . _i2)+        (mkFinMatC @'[2, 3, 4] 10 (_2P :| [_3P, _4P]) ^. _Right . _i2)           @?= (FinU _3P _3P :: Fin 3)     , testCase "_i3 view" $-        (mkFinMatC @(NS '[2, 3, 4]) 10 (_2P :| [_3P, _4P]) ^. _Right . _i3)+        (mkFinMatC @'[2, 3, 4] 10 (_2P :| [_3P, _4P]) ^. _Right . _i3)           @?= (FinU _3P _4P :: Fin 4)     , testCase "_i2 update" $-        (mkFinMatC @(NS '[2, 3, 4]) 0 (_2P :| [_3P, _4P]) & _Right . _i2 %~ succ)+        (mkFinMatC @'[2, 3, 4] 0 (_2P :| [_3P, _4P]) & _Right . _i2 %~ succ)           @?= Right (FinMatU 4 (_2P :| [_3P, _4P]))     , testCase "read" $-        (read @(FinMat (NS '[2, 3, 4])) $ show (finMatC @(NS '[2, 3, 4]) @(NS '[2, 3, 4])))-          @?= finMatC @(NS '[2, 3, 4]) @(NS '[2, 3, 4])+        (read @(FinMat '[2, 3, 4]) $ show (finMatC @'[2, 3, 4] @'[2, 3, 4]))+          @?= finMatC @'[2, 3, 4] @'[2, 3, 4]     , testCase "read" $-        (read @(FinMat (NS '[2, 3, 4])) $ show (finMatC @(NS '[1, 3, 2]) @(NS '[2, 3, 4])))-          @?= finMatC @(NS '[1, 3, 2]) @(NS '[2, 3, 4])+        (read @(FinMat '[2, 3, 4]) $ show (finMatC @'[1, 3, 2] @'[2, 3, 4]))+          @?= finMatC @'[1, 3, 2] @'[2, 3, 4]     , testCase "enum roundtrip" $-        let xs = universe1 @(FinMat (NS '[2, 4, 3]))+        let xs = universe1 @(FinMat '[2, 4, 3])             ys = fromEnum <$> xs          in do-              fmap (toEnum @(FinMat (NS '[2, 4, 3]))) ys @?= xs+              fmap (toEnum @(FinMat '[2, 4, 3])) ys @?= xs               ys @?= 0 :| [1 .. 23]               N.head xs @?= minBound               N.last xs @?= maxBound     , testCase "showFinMat" $-        map showFinMat [FinMatU @(NS '[2, 3, 5]) 0 (_2P :| [_3P, _5P]), toEnum 5 ..]+        map showFinMat [FinMatU @'[2, 3, 5] 0 (_2P :| [_3P, _5P]), toEnum 5 ..]           @?= ["0@{2,3,5}", "5@{2,3,5}", "10@{2,3,5}", "15@{2,3,5}", "20@{2,3,5}", "25@{2,3,5}"]     , testCase "nonEmptyToFinMat'" $         nonEmptyToFinMat' (_1P :| [_4P, _3P]) (_1P :| [_3P, _4P])@@ -227,25 +226,25 @@           @?= Left "nonEmptyToFinMat:not enough indices: expected 3 is=1P :| [2P] ns=1P :| [3P,4P]"     , testCase "nonEmptyToFinMat'" $         nonEmptyToFinMat' (_3P :| [_1P, _4P]) (_3P :| [_8P, _7P])-          @?= Right (FinMatU @(NS '[3, 8, 7]) 115 (_3P :| [_8P, _7P]))+          @?= Right (FinMatU @'[3, 8, 7] 115 (_3P :| [_8P, _7P]))     , testCase "finMatToNonEmpty" $-        finMatToNonEmpty (FinMatU @(NS '[3, 8, 7]) 115 (_3P :| [_8P, _7P])) @?= _3P :| [_1P, _4P]+        finMatToNonEmpty (FinMatU @'[3, 8, 7] 115 (_3P :| [_8P, _7P])) @?= _3P :| [_1P, _4P]     , testCase "finMatToNonEmpty" $-        finMatToNonEmpty (FinMatU @(NS '[3, 8, 7]) 167 (_3P :| [_8P, _7P])) @?= _3P :| [_8P, _7P]+        finMatToNonEmpty (FinMatU @'[3, 8, 7] 167 (_3P :| [_8P, _7P])) @?= _3P :| [_8P, _7P]     , testCase "finMatToNonEmpty" $-        finMatToNonEmpty (FinMatU @(NS '[3, 8, 7]) 0 (_3P :| [_8P, _7P])) @?= _1P :| [_1P, _1P]+        finMatToNonEmpty (FinMatU @'[3, 8, 7] 0 (_3P :| [_8P, _7P])) @?= _1P :| [_1P, _1P]     , testCase "finMatToNonEmpty" $-        finMatToNonEmpty (FinMatU @(NS '[1]) 0 (_1P :| [])) @?= _1P :| []+        finMatToNonEmpty (FinMatU @'[1] 0 (_1P :| [])) @?= _1P :| []     , testCase "finMatToNonEmpty" $-        finMatToNonEmpty (FinMatU @(NS '[7]) 0 (_7P :| [])) @?= _1P :| []+        finMatToNonEmpty (FinMatU @'[7] 0 (_7P :| [])) @?= _1P :| []     , testCase "finMatToNonEmpty" $-        finMatToNonEmpty (FinMatU @(NS '[7]) 6 (_7P :| [])) @?= _7P :| []+        finMatToNonEmpty (FinMatU @'[7] 6 (_7P :| [])) @?= _7P :| []     , testCase "finMatC" $         (finMatC @(NN 1234) @(NN 1234) - minBound)-          @?= FinMatU @(1 ':| '[2, 3, 4]) 23 (_1P :| [_2P, _3P, _4P])+          @?= FinMatU @'[1, 2, 3, 4] 23 (_1P :| [_2P, _3P, _4P])     , testCase "finMatC" $         (pure (finMatC @(NN 1234) @(NN 1234)) .- pure minBound)-          @?= Right (FinMatU @(1 ':| '[2, 3, 4]) 23 (_1P :| [_2P, _3P, _4P]))+          @?= Right (FinMatU @'[1, 2, 3, 4] 23 (_1P :| [_2P, _3P, _4P]))     , testCase "finMatC" $         pure (finMatC @(NN 1234) @(NN 1234)) .+ pure maxBound           @?= Left "(.+):mkFinMat:is too large: maximum is 23 but found 46"@@ -313,26 +312,26 @@         withOp pred (finMatC @(NN 234) @(NN 234))           @?= Right (FinMatU 22 (_2P :| [_3P, _4P]))     , testCase "finMatC" $-        (finMatC @(NS '[1, 3, 4]) @(NS '[2, 3, 7]) & _i3 %~ succ . succ)-          @?= FinMatU @(NS '[2, 3, 7]) 19 (_2P :| [_3P, _7P])+        (finMatC @'[1, 3, 4] @'[2, 3, 7] & _i3 %~ succ . succ)+          @?= FinMatU @'[2, 3, 7] 19 (_2P :| [_3P, _7P])     , testCase "finMatC" $-        (finMatC @(NS '[1, 3, 4]) @(NS '[2, 3, 7]) & _i1 %~ succ)-          @?= FinMatU @(NS '[2, 3, 7]) 38 (_2P :| [_3P, _7P])+        (finMatC @'[1, 3, 4] @'[2, 3, 7] & _i1 %~ succ)+          @?= FinMatU @'[2, 3, 7] 38 (_2P :| [_3P, _7P])     , testCase "finMatC" $-        (finMatC @(NS '[1, 3, 4]) @(NS '[2, 3, 7]) & _i3 .~ _F2)-          @?= FinMatU @(NS '[2, 3, 7]) 15 (_2P :| [_3P, _7P])+        (finMatC @'[1, 3, 4] @'[2, 3, 7] & _i3 .~ _F2)+          @?= FinMatU @'[2, 3, 7] 15 (_2P :| [_3P, _7P])     , testCase "finMatC" $-        (finMatC @(NS '[1, 3, 4]) @(NS '[2, 3, 7]) & _i3 .~ _F3)-          @?= FinMatU @(NS '[2, 3, 7]) 16 (_2P :| [_3P, _7P])+        (finMatC @'[1, 3, 4] @'[2, 3, 7] & _i3 .~ _F3)+          @?= FinMatU @'[2, 3, 7] 16 (_2P :| [_3P, _7P])     , testCase "finMatC" $-        (finMatC @(NS '[1, 1]) @(NS '[11, 7]) & _i1 %~ succ)-          @?= FinMatU @(NS '[11, 7]) 7 (_11P :| [_7P])+        (finMatC @'[1, 1] @'[11, 7] & _i1 %~ succ)+          @?= FinMatU @'[11, 7] 7 (_11P :| [_7P])     , testCase "finMatC" $-        (finMatC @(NS '[1, 1]) @(NS '[11, 7]) & _i1 %~ id)-          @?= FinMatU @(NS '[11, 7]) 0 (_11P :| [_7P])+        (finMatC @'[1, 1] @'[11, 7] & _i1 %~ id)+          @?= FinMatU @'[11, 7] 0 (_11P :| [_7P])     , testCase "finMatC" $-        (finMatC @(NS '[1, 1]) @(NS '[11, 7]) & _i1 %~ succ . succ)-          @?= FinMatU @(NS '[11, 7]) 14 (_11P :| [_7P])+        (finMatC @'[1, 1] @'[11, 7] & _i1 %~ succ . succ)+          @?= FinMatU @'[11, 7] 14 (_11P :| [_7P])     , testCase "finMatC" $         (finMatC @(NN 543) @(NN 789) ^. _i1)           @?= FinU _5P _7P@@ -344,22 +343,22 @@           @?= FinU _3P _9P     , testCase "toFinMatFromPos" $         toFinMatFromPos @0 @(NN 345)-          @?= FinMatU @(3 ':| '[4, 5]) 0 (_3P :| [_4P, _5P])+          @?= FinMatU @'[3, 4, 5] 0 (_3P :| [_4P, _5P])     , testCase "toFinMatFromPos" $         toFinMatFromPos @59 @(NN 345)-          @?= FinMatU @(3 ':| '[4, 5]) 59 (_3P :| [_4P, _5P])+          @?= FinMatU @'[3, 4, 5] 59 (_3P :| [_4P, _5P])     , testCase "toFinMatFromPos" $         toFinMatFromPos @34 @(NN 345)-          @?= FinMatU @(3 ':| '[4, 5]) 34 (_3P :| [_4P, _5P])+          @?= FinMatU @'[3, 4, 5] 34 (_3P :| [_4P, _5P])     , testCase "toFinMatFromPos" $-        toFinMatFromPos @0 @(1 ':| '[])-          @?= FinMatU @(1 ':| '[]) 0 (_1P :| [])+        toFinMatFromPos @0 @'[1]+          @?= FinMatU @'[1] 0 (_1P :| [])     , testCase "toFinMatFromPos" $-        toFinMatFromPos @0 @(2 ':| '[])-          @?= FinMatU @(2 ':| '[]) 0 (_2P :| [])+        toFinMatFromPos @0 @'[2]+          @?= FinMatU @'[2] 0 (_2P :| [])     , testCase "toFinMatFromPos" $-        toFinMatFromPos @1 @(2 ':| '[])-          @?= FinMatU @(2 ':| '[]) 1 (_2P :| [])+        toFinMatFromPos @1 @'[2]+          @?= FinMatU @'[2] 1 (_2P :| [])     , testCase "relPos" $         relPos ((_1P, _3P) :| []) @?= (_3P, 0)     , testCase "relPos" $@@ -371,20 +370,20 @@     , testCase "relPos" $         relPos ((_4P, _7P) :| [(_3P, _5P), (_2P, _5P)]) @?= (_P @175, 86)     , testCase "readFinMat" $-        readFinMat @(NS '[7, 3, 3]) "5@{7,3,3}xyz" @?= [(finMatC @(NS '[1, 2, 3]) @(NS '[7, 3, 3]), "xyz")]+        readFinMat @'[7, 3, 3] "5@{7,3,3}xyz" @?= [(finMatC @'[1, 2, 3] @'[7, 3, 3], "xyz")]     , testCase "readFinMat" $-        let m = finMatC @(NS '[1, 2, 3]) @(NS '[7, 3, 3])-         in readFinMat @(NS '[7, 3, 3]) (show m ++ "  ") @?= [(m, "  ")]+        let m = finMatC @'[1, 2, 3] @'[7, 3, 3]+         in readFinMat @'[7, 3, 3] (show m ++ "  ") @?= [(m, "  ")]     , testCase "readFinMat" $-        readFinMat @(NS '[7, 3, 3]) "6@{1,2,3}xyz" @?= []+        readFinMat @'[7, 3, 3] "6@{1,2,3}xyz" @?= []     , testCase "readFinMat" $-        readFinMat @(NS '[1, 2, 3]) "         4@{     1,             2,   3}xy"-          @?= [(FinMatU @(NS '[1, 2, 3]) 4 (_1P :| [_2P, _3P]), "xy")]+        readFinMat @'[1, 2, 3] "         4@{     1,             2,   3}xy"+          @?= [(FinMatU @'[1, 2, 3] 4 (_1P :| [_2P, _3P]), "xy")]     , testCase "showFinMat'" $-        showFinMat' (finMatC @(2 ':| '[3, 5]) @(4 ':| '[4, 6]))+        showFinMat' (finMatC @'[2, 3, 5] @'[4, 4, 6])           @?= "40@{2,3,5|4,4,6}"     , testCase "showFinMat'" $-        showFinMat' (finMatC @(1 ':| '[]) @(1 ':| '[]))+        showFinMat' (finMatC @'[1] @'[1])           @?= "0@{1|1}"     , testCase "showFinMat'" $         showFinMat' (finMatC @(NN 123) @(NN 234))@@ -399,50 +398,65 @@         showFinMat' (finMatC @(NN 9) @(NN 9))           @?= "8@{9|9}"     , testCase "showFinMat" $-        showFinMat (finMatC @(1 ':| '[]) @(1 ':| '[]))+        showFinMat (finMatC @'[1] @'[1])           @?= "0@{1}"     , testCase "showFinMat" $-        showFinMat (finMatC @(1 ':| '[]) @(10 ':| '[]))+        showFinMat (finMatC @'[1] @'[10])           @?= "0@{10}"     , testCase "showFinMat" $-        showFinMat (finMatC @(10 ':| '[]) @(10 ':| '[]))+        showFinMat (finMatC @'[10] @'[10])           @?= "9@{10}"     , testCase "showFinMat" $-        showFinMat (finMatC @(4 ':| '[]) @(10 ':| '[]))+        showFinMat (finMatC @'[4] @'[10])           @?= "3@{10}"     , testCase "fromInteger1" $-        fromInteger1 (minBound @(FinMat (2 ':| '[3, 4]))) 0-          @?= Right (FinMatU @(NS '[2, 3, 4]) 0 (_2P :| [_3P, _4P]))+        fromInteger1 (minBound @(FinMat '[2, 3, 4])) 0+          @?= Right (FinMatU @'[2, 3, 4] 0 (_2P :| [_3P, _4P]))     , testCase "fromInteger1" $-        fromInteger1 (minBound @(FinMat (2 ':| '[3, 4]))) (-5)+        fromInteger1 (minBound @(FinMat '[2, 3, 4])) (-5)           @?= Left "mkFinMat:cant be less than 0: i=-5"     , testCase "fromInteger1" $-        fromInteger1 (minBound @(FinMat (2 ':| '[3, 4]))) 23-          @?= Right (FinMatU @(NS '[2, 3, 4]) 23 (_2P :| [_3P, _4P]))+        fromInteger1 (minBound @(FinMat '[2, 3, 4])) 23+          @?= Right (FinMatU @'[2, 3, 4] 23 (_2P :| [_3P, _4P]))     , testCase "fromInteger1" $-        fromInteger1 (minBound @(FinMat (2 ':| '[3, 4]))) 24+        fromInteger1 (minBound @(FinMat '[2, 3, 4])) 24           @?= Left "mkFinMat:is too large: maximum is 23 but found 24"     , testCase "fromInteger1" $-        fromInteger1 (minBound @(FinMat (2 ':| '[3, 4]))) (-1)+        fromInteger1 (minBound @(FinMat '[2, 3, 4])) (-1)           @?= Left "mkFinMat:cant be less than 0: i=-1"     , testCase "toInteger1" $-        toInteger1 (FinMatU @(NS '[2, 3, 4]) 0 (_2P :| [_3P, _4P]))+        toInteger1 (FinMatU @'[2, 3, 4] 0 (_2P :| [_3P, _4P]))           @?= 0     , testCase "toInteger1" $-        toInteger1 (FinMatU @(NS '[2, 3, 4]) 23 (_2P :| [_3P, _4P]))+        toInteger1 (FinMatU @'[2, 3, 4] 23 (_2P :| [_3P, _4P]))           @?= 23     , testCase "toInteger1" $-        toInteger1 (FinMatU @(NS '[2, 3, 4]) 12 (_2P :| [_3P, _4P]))+        toInteger1 (FinMatU @'[2, 3, 4] 12 (_2P :| [_3P, _4P]))           @?= 12+    , testCase "index lenses" $+         finMatC @'[2,5,3,7] @'[2,12,13,8] ^. _i1+           @?= FinU @2 _2P _2P+    , testCase "index lenses" $+         finMatC @'[2,5,3,7] @'[2,12,13,8] ^. _i2+           @?= FinU @12 _5P _12P+    , testCase "index lenses" $+         finMatC @'[2,5,3,7] @'[2,12,13,8] ^. _i4+           @?= FinU @8 _7P _8P+    , testCase "finMat finMatC" $+         finMat @'[2,12,13,8] (6 + 2*8 + 4*13*8 + 1*12*13*8)+         @?= Right (finMatC @'[2,5,3,7] @'[2,12,13,8])+    , testCase "finMat finMatC" $+         finMat @'[21] 0+         @?= Right (finMatC @'[1] @'[21])     ] -fmi237' :: NonEmpty (FinMat (NS '[2, 3, 7]))+fmi237' :: NonEmpty (FinMat '[2, 3, 7]) fmi237' = frp $ traverse (nonEmptyToFinMat <=< toPositives) fmi237  fmi237 :: NonEmpty (NonEmpty Int) fmi237 = fmap N.fromList $ [1, 1, 1] :| [[1, 1, 2], [1, 1, 3], [1, 1, 4], [1, 1, 5], [1, 1, 6], [1, 1, 7], [1, 2, 1], [1, 2, 2], [1, 2, 3], [1, 2, 4], [1, 2, 5], [1, 2, 6], [1, 2, 7], [1, 3, 1], [1, 3, 2], [1, 3, 3], [1, 3, 4], [1, 3, 5], [1, 3, 6], [1, 3, 7], [2, 1, 1], [2, 1, 2], [2, 1, 3], [2, 1, 4], [2, 1, 5], [2, 1, 6], [2, 1, 7], [2, 2, 1], [2, 2, 2], [2, 2, 3], [2, 2, 4], [2, 2, 5], [2, 2, 6], [2, 2, 7], [2, 3, 1], [2, 3, 2], [2, 3, 3], [2, 3, 4], [2, 3, 5], [2, 3, 6], [2, 3, 7]] -fmiNS' :: forall ns. NSC ns => NonEmpty (FinMat ns)+fmiNS' :: forall ns. NS ns => NonEmpty (FinMat ns) fmiNS' = frp $ traverse (nonEmptyToFinMat @ns <=< toPositives) (fmiNS (fmap unP (fromNSP @ns)))  fmiNS :: NonEmpty Int -> NonEmpty (NonEmpty Int)
test/TestMat.hs view
@@ -7,7 +7,6 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-}-{-# LANGUAGE TypeOperators #-}  module TestMat where @@ -42,42 +41,42 @@ import Test.Tasty.HUnit import qualified Test.Tasty.QuickCheck as TQ -instance (NSC ns, Arbitrary a) => Arbitrary (Mat ns a) where+instance (NS ns, Arbitrary a) => Arbitrary (Mat ns a) where   arbitrary = sequenceA $ mat @ns (repeat arbitrary)  instance Eq a => EqProp (Mat ns a) where (=-=) = eq -testLawsMat :: forall (ns :: NonEmpty Nat). (ShowMatC ns, NSC ns) => [TestBatch]+testLawsMat :: forall (ns :: [Nat]). (ShowMatC ns, NS ns) => [TestBatch] testLawsMat =   [functor z, applicative z, monoid z, monad z, semigroup (z, Fixed (10 :: Int)), foldable z1] --  , traversable z]  where   z = undefined :: Mat ns (MA, MB, MC)   z1 = undefined :: Mat ns (MA, MB, MC, Int, MD) -testLawsMat' :: forall (ns :: NonEmpty Nat). (ShowMatC ns, NSC ns) => [TestBatch]+testLawsMat' :: forall (ns :: [Nat]). (ShowMatC ns, NS ns) => [TestBatch] testLawsMat' =-  [functor z, applicative z, monoid z, monad z, semigroup (z, Fixed (10 :: Int)), foldable z1]  --  , traversable z]+  [functor z, applicative z, monoid z, monad z, semigroup (z, Fixed (10 :: Int)), foldable z1] --  , traversable z]  where   z = undefined :: Mat ns (MM.Sum Integer, String, MM.Sum Int)   z1 = undefined :: Mat ns (String, Integer, String, Int, Bool) --- testLawsMat @(NS '[2,3,4])-testLawsMatIO :: forall (ns :: NonEmpty Nat). (ShowMatC ns, NSC ns) => IO ()+-- testLawsMat @'[2,3,4]+testLawsMatIO :: forall (ns :: [Nat]). (ShowMatC ns, NS ns) => IO () testLawsMatIO = traverse_ verboseBatch (testLawsMat @ns) -testLawsMatIO' :: forall (ns :: NonEmpty Nat). (ShowMatC ns, NSC ns) => IO ()+testLawsMatIO' :: forall (ns :: [Nat]). (ShowMatC ns, NS ns) => IO () testLawsMatIO' = traverse_ verboseBatch (testLawsMat' @ns)  doit :: IO () doit = defaultMain suite -m345 :: Mat (NS '[3, 4, 5]) Char+m345 :: Mat '[3, 4, 5] Char m345 = mat' ['A' .. '|'] -m345' :: Mat (NS '[3, 4, 5]) Int+m345' :: Mat '[3, 4, 5] Int m345' = mat' [1 .. 60] -m35 :: Mat (NS '[3, 5]) Int+m35 :: Mat '[3, 5] Int m35 = mat' [1 .. 15]  suite :: TestTree@@ -85,25 +84,25 @@   testGroup     "TestMat"     [ testCase "gen" $-        gen @(NS '[2, 3]) id+        gen @'[2, 3] id           @?= MatU (V.fromList [0 .. 5]) (_2P :| [_3P])     , testCase "gen" $-        gen @(NS '[9]) id+        gen @'[9] id           @?= MatU (V.fromList [0 .. 8]) (_9P :| [])     , testCase "get index 0" $         indexMat (FinMatU 0 (_3P :| [_4P, _5P])) m345           @?= 'A'     , testCase "get index 4" $-        indexMat (FinMatU 4 (_2P :| [_3P, _6P])) (gen' @(NS '[2, 3, 6]) id)+        indexMat (FinMatU 4 (_2P :| [_3P, _6P])) (gen' @'[2, 3, 6] id)           @?= [1, 1, 5]     , testCase "get index 4" $-        indexMat (finMatC @(NS '[2, 1, 5])) (gen' @(NS '[2, 3, 6]) id)+        indexMat (finMatC @'[2, 1, 5]) (gen' @'[2, 3, 6] id)           @?= [2, 1, 5]     , testCase "get index 2" $-        m345 ^. ixMat' @(NS '[1, 2, 1])+        m345 ^. ixMat' @'[1, 2, 1]           @?= 'F'     , testCase "update index 2" $-        matToNestedListC (m345' & ixMat' @(NS '[1, 2, 1]) %~ succ)+        matToNestedListC (m345' & ixMat' @'[1, 2, 1] %~ succ)           @?= [[[1, 2, 3, 4, 5], [7, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]], [[21, 22, 23, 24, 25], [26, 27, 28, 29, 30], [31, 32, 33, 34, 35], [36, 37, 38, 39, 40]], [[41, 42, 43, 44, 45], [46, 47, 48, 49, 50], [51, 52, 53, 54, 55], [56, 57, 58, 59, 60]]]     , testCase "reverseRows" $         matToNestedListC (reverseRows m345)@@ -115,7 +114,7 @@         reverseRows (reverseRows m345)           @?= m345     , testCase "update index 2" $-        matToNestedListC (m345' & ixMat' @(NS '[1, 2, 1]) %~ succ)+        matToNestedListC (m345' & ixMat' @'[1, 2, 1] %~ succ)           @?= [[[1, 2, 3, 4, 5], [7, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]], [[21, 22, 23, 24, 25], [26, 27, 28, 29, 30], [31, 32, 33, 34, 35], [36, 37, 38, 39, 40]], [[41, 42, 43, 44, 45], [46, 47, 48, 49, 50], [51, 52, 53, 54, 55], [56, 57, 58, 59, 60]]]     , testCase "transpose" $         matToNestedListC (transposeMat m35)@@ -127,250 +126,250 @@         matToNestedListC (fmap (show . succ) m35)           @?= [["2", "3", "4", "5", "6"], ["7", "8", "9", "10", "11"], ["12", "13", "14", "15", "16"]]     , testCase "totuple" $-        toTupleC (mat' @(NS '[2, 3, 2]) [1 :: Int .. 12])+        toTupleC (mat' @'[2, 3, 2] [1 :: Int .. 12])           @?= (((1, 2), (3, 4), (5, 6)), ((7, 8), (9, 10), (11, 12)))     , testCase "fromtuple" $         fromTupleC (((1, 2), (3, 4), (5, 6)), ((7, 8), (9, 10), (11, 12)))-          @?= mat' @(NS '[2, 3, 2]) [1 :: Int .. 12]+          @?= mat' @'[2, 3, 2] [1 :: Int .. 12]     , testCase "change row" $-        (mat' @(NS '[3, 4]) [1 :: Int .. 12] & ixSlice @(NS '[2, 3]) .~ 999)-          @?= mat' @(NS '[3, 4]) [1, 2, 3, 4, 5, 6, 999, 8, 9, 10, 11, 12]+        (mat' @'[3, 4] [1 :: Int .. 12] & ixSlice @'[2, 3] .~ 999)+          @?= mat' @'[3, 4] [1, 2, 3, 4, 5, 6, 999, 8, 9, 10, 11, 12]     , testCase "change row" $-        (mat' @(NS '[3, 4]) [1 :: Int .. 12] & ixSlice @(NS '[1]) *~ 999)-          @?= mat' @(NS '[3, 4]) [999, 1998, 2997, 3996, 5, 6, 7, 8, 9, 10, 11, 12]+        (mat' @'[3, 4] [1 :: Int .. 12] & ixSlice @'[1] *~ 999)+          @?= mat' @'[3, 4] [999, 1998, 2997, 3996, 5, 6, 7, 8, 9, 10, 11, 12]     , testCase "change row" $-        m345 ^. ixSlice @(NS '[2, 3])-          @?= mat' @(NS '[5]) ['_' .. 'c']+        m345 ^. ixSlice @'[2, 3]+          @?= mat' @'[5] ['_' .. 'c']     , testCase "change row" $-        (m35 & ixSlice @(NS '[2]) . traverse *~ 100)-          @?= mat' @(NS '[3, 5]) [1, 2, 3, 4, 5, 600, 700, 800, 900, 1000, 11, 12, 13, 14, 15]+        (m35 & ixSlice @'[2] . traverse *~ 100)+          @?= mat' @'[3, 5] [1, 2, 3, 4, 5, 600, 700, 800, 900, 1000, 11, 12, 13, 14, 15]     , testCase "change row" $-        (mat' @(NS '[2, 1, 2, 3, 4]) [1 :: Int .. 48] & ixSlice @(NS '[2, 1, 1]) . traverse *~ 100)-          @?= mat' @(NS '[2, 1, 2, 3, 4]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48]+        (mat' @'[2, 1, 2, 3, 4] [1 :: Int .. 48] & ixSlice @'[2, 1, 1] . traverse *~ 100)+          @?= mat' @'[2, 1, 2, 3, 4] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300, 3400, 3500, 3600, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48]     , testCase "change row" $-        m345 ^. ixSlice @(NS '[2])-          @?= mat' @(NS '[4, 5]) ['U' .. 'h']+        m345 ^. ixSlice @'[2]+          @?= mat' @'[4, 5] ['U' .. 'h']     , testCase "not as useful: nests all stuff" $-        fmap sum (matToNestedVecC @(NS '[2, 3]) (mat' [1 :: Int .. 6]))+        fmap sum (matToNestedVecC @'[2, 3] (mat' [1 :: Int .. 6]))           @?= 6 .| 15     , testCase "mapLeaf: change the lowest rows into lists" $-        mapLeaf (const sum) (mat' @(NS '[4, 3]) [1 :: Int .. 12])-          @?= mat' @(NS '[4]) [6, 15, 24, 33]+        mapLeaf (const sum) (mat' @'[4, 3] [1 :: Int .. 12])+          @?= mat' @'[4] [6, 15, 24, 33]     , testCase "mapLeafSimple" $-        mapLeafSimple (fmap . (,) . fmPos) (mm' @43)-          @?= mat' @(NS '[4, 3]) [(0, [1, 1]), (0, [1, 2]), (0, [1, 3]), (3, [2, 1]), (3, [2, 2]), (3, [2, 3]), (6, [3, 1]), (6, [3, 2]), (6, [3, 3]), (9, [4, 1]), (9, [4, 2]), (9, [4, 3])]+        mapLeafSimple (fmap . (,) . fmPos) (gen' @(NN 43) id)+          @?= mat' @'[4, 3] [(0, [1, 1]), (0, [1, 2]), (0, [1, 3]), (3, [2, 1]), (3, [2, 2]), (3, [2, 3]), (6, [3, 1]), (6, [3, 2]), (6, [3, 3]), (9, [4, 1]), (9, [4, 2]), (9, [4, 3])]     , testCase "toLeaves" $-        toLeaves (mm' @23)-          @?= mat' @(NS '[2]) [mat' @(NS '[3]) [[1, 1], [1, 2], [1, 3]], mat' [[2, 1], [2, 2], [2, 3]]]+        toLeaves (gen' @(NN 23) id)+          @?= mat' @'[2] [mat' @'[3] [[1, 1], [1, 2], [1, 3]], mat' [[2, 1], [2, 2], [2, 3]]]     , testCase "toLeaves" $-        mat' @(NS '[2]) [mat' @(NS '[3]) [[1, 1], [1, 2], [1, 3]], mat' [[2, 1], [2, 2], [2, 3]]]-          @?= toLeaves (mm' @23)+        mat' @'[2] [mat' @'[3] [[1, 1], [1, 2], [1, 3]], mat' [[2, 1], [2, 2], [2, 3]]]+          @?= toLeaves (gen' @(NN 23) id)     , testCase "fromLeavesInternalC toLeaves" $-        fromLeavesInternalC (toLeaves (mm' @3214))-          @?= mm' @3214+        fromLeavesInternalC (toLeaves (gen' @(NN 3214) id))+          @?= gen' @(NN 3214) id     , testCase "foldMapLeaf" $-        foldMapLeaf (\i m -> [(fmPos i, sum m, toList m)]) (mm @234)+        foldMapLeaf (\i m -> [(fmPos i, sum m, toList m)]) (mm @(NN 234))           @?= [(0, 10, [1, 2, 3, 4]), (4, 26, [5, 6, 7, 8]), (8, 42, [9, 10, 11, 12]), (12, 58, [13, 14, 15, 16]), (16, 74, [17, 18, 19, 20]), (20, 90, [21, 22, 23, 24])]     , testCase "foldMapLeafR" $-        foldMapLeafR (\i m -> [(fmPos i, sum m, toList m)]) (mm @234)+        foldMapLeafR (\i m -> [(fmPos i, sum m, toList m)]) (mm @(NN 234))           @?= [(20, 90, [21, 22, 23, 24]), (16, 74, [17, 18, 19, 20]), (12, 58, [13, 14, 15, 16]), (8, 42, [9, 10, 11, 12]), (4, 26, [5, 6, 7, 8]), (0, 10, [1, 2, 3, 4])]-     , testCase "addition" $-        mat' @(NS '[2, 3]) [1 .. 6] + mat' [100 :: Int .. 105]+    , testCase "addition" $+        mat' @'[2, 3] [1 .. 6] + mat' [100 :: Int .. 105]           @?= mat' [101, 103, 105, 107, 109, 111]     , testCase "multiplication" $-        mat' @(NS '[2, 3]) [1 .. 6] * mat' [100 :: Int .. 105]+        mat' @'[2, 3] [1 .. 6] * mat' [100 :: Int .. 105]           @?= mat' [100, 202, 306, 412, 520, 630] -- note: have to use mat' for inference to work     , testCase "transpose" $-        transposeMat (mat' @(NS '[2, 3]) [1 :: Int .. 6])+        transposeMat (mat' @'[2, 3] [1 :: Int .. 6])           @?= mat' [1, 4, 2, 5, 3, 6]     , testCase "transpose iso" $         transposeMat (transposeMat m345)           @?= m345     , testCase "diagonal" $-        diagonal (mat' @(NS '[3, 3, 4]) [1 :: Int .. 36])+        diagonal (mat' @'[3, 3, 4] [1 :: Int .. 36])           @?= mat' [1, 2, 3, 4, 17, 18, 19, 20, 33, 34, 35, 36]     , testCase "diagonal" $-        diagonal (gen @(NS '[4, 4]) succ)+        diagonal (gen @'[4, 4] succ)           @?= mat' [1, 6, 11, 16]     , testCase "diagonal" $-        diagonal (diagonal (diagonal (mm' @3333)))-          @?= mat' @(NS '[3]) [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]]+        diagonal (diagonal (diagonal (gen' @(NN 3333) id)))+          @?= mat' @'[3] [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]]     , testCase "fromNSP" $-        fromNSP @(NS '[4, 2, 3, 5, 1])+        fromNSP @'[4, 2, 3, 5, 1]           @?= _4P :| [_2P, _3P, _5P, _1P]     , testCase "finMatMatrix" $-        finMatMatrix @(NS '[2, 3, 1])+        finMatMatrix @'[2, 3, 1]           @?= mat' (toList (N.map (fr . (nonEmptyToFinMat <=< toPositives)) ([1, 1, 1] :| [[1, 2, 1], [1, 3, 1], [2, 1, 1], [2, 2, 1], [2, 3, 1]])))     , testCase "insert row" $-        insertRow @2 (mat' @(NS '[3, 4]) [100 .. 111]) (mat' @(NS '[2, 3, 4]) [1 :: Int .. 24])+        insertRow @2 (mat' @'[3, 4] [100 .. 111]) (mat' @'[2, 3, 4] [1 :: Int .. 24])           @?= mat' [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]     , testCase "insert column" $-        insertCol @2 (mat' @(NS '[2, 4]) [100 .. 107]) (mat' @(NS '[2, 3, 4]) [1 :: Int .. 24])+        insertCol @2 (mat' @'[2, 4] [100 .. 107]) (mat' @'[2, 3, 4] [1 :: Int .. 24])           @?= mat' [1, 2, 3, 4, 100, 101, 102, 103, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 104, 105, 106, 107, 17, 18, 19, 20, 21, 22, 23, 24]     , testCase "delete row" $-        deleteRow @2 (mat' @(NS '[2, 3, 4]) [1 :: Int .. 24])+        deleteRow @2 (mat' @'[2, 3, 4] [1 :: Int .. 24])           @?= mat' [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]     , testCase "insert/delete row" $-        deleteRow @2 (insertRow @2 (mat' @(NS '[4, 5]) [100 .. 119]) m345')+        deleteRow @2 (insertRow @2 (mat' @'[4, 5] [100 .. 119]) m345')           @?= m345'     , testCase "to nested lists" $-        matToNestedListC (mat' @(NS '[2, 3, 4]) [1 :: Int .. 24])+        matToNestedListC (mat' @'[2, 3, 4] [1 :: Int .. 24])           @?= [[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]], [[13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24]]]     , testCase "concat vertically" $-        matToNestedListC (appendV (mat' @(NS '[2, 3, 2]) [1 .. 12]) (mat' @(NS '[5, 3, 2]) [100 :: Int .. 129]))+        matToNestedListC (appendV (mat' @'[2, 3, 2] [1 .. 12]) (mat' @'[5, 3, 2] [100 :: Int .. 129]))           @?= [[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11, 12]], [[100, 101], [102, 103], [104, 105]], [[106, 107], [108, 109], [110, 111]], [[112, 113], [114, 115], [116, 117]], [[118, 119], [120, 121], [122, 123]], [[124, 125], [126, 127], [128, 129]]]     , testCase "concat vertically" $-        matToNestedListC (appendV (mat' @(NS '[2, 3]) [1 .. 6]) (mat' @(NS '[7, 3]) [100 :: Int .. 120]))+        matToNestedListC (appendV (mat' @'[2, 3] [1 .. 6]) (mat' @'[7, 3] [100 :: Int .. 120]))           @?= [[1, 2, 3], [4, 5, 6], [100, 101, 102], [103, 104, 105], [106, 107, 108], [109, 110, 111], [112, 113, 114], [115, 116, 117], [118, 119, 120]]     , testCase "concat horizontally" $-        matToNestedListC (appendH (mat' @(NS '[5, 2, 2]) [1 .. 20]) (mat' @(NS '[5, 3, 2]) [100 :: Int .. 129]))+        matToNestedListC (appendH (mat' @'[5, 2, 2] [1 .. 20]) (mat' @'[5, 3, 2] [100 :: Int .. 129]))           @?= [[[1, 2], [3, 4], [100, 101], [102, 103], [104, 105]], [[5, 6], [7, 8], [106, 107], [108, 109], [110, 111]], [[9, 10], [11, 12], [112, 113], [114, 115], [116, 117]], [[13, 14], [15, 16], [118, 119], [120, 121], [122, 123]], [[17, 18], [19, 20], [124, 125], [126, 127], [128, 129]]]     , testCase "concat horizontally" $-        matToNestedListC (appendH (mat' @(NS '[3, 2]) [1 .. 6]) (mat' @(NS '[3, 7]) [100 :: Int .. 120]))+        matToNestedListC (appendH (mat' @'[3, 2] [1 .. 6]) (mat' @'[3, 7] [100 :: Int .. 120]))           @?= [[1, 2, 100, 101, 102, 103, 104, 105, 106], [3, 4, 107, 108, 109, 110, 111, 112, 113], [5, 6, 114, 115, 116, 117, 118, 119, 120]]     , testCase "consMat" $-        (gen @(NS '[3, 4]) succ ^. consMat)+        (gen @'[3, 4] succ ^. consMat)           @?= (1 .: 2 .: 3 .| 4, 5 .: 6 .: 7 .| 8 .|| (9 .: 10 .: 11 .| 12))     , testCase "snocMat" $-        (gen @(NS '[3, 4]) succ ^. snocMat)+        (gen @'[3, 4] succ ^. snocMat)           @?= (1 .: 2 .: 3 .| 4 .|| (5 .: 6 .: 7 .| 8), 9 .: 10 .: 11 .| 12)     , testCase "consMat" $-        (gen @(NS '[3, 4]) succ & consMat . _1 +~ 1000)+        (gen @'[3, 4] succ & consMat . _1 +~ 1000)           @?= ((1001 .: 1002 .: 1003 .| 1004) .:: (5 .: 6 .: 7 .| 8) .|| (9 .: 10 .: 11 .| 12))     , testCase "snocMat" $-        (gen @(NS '[3, 4]) succ & snocMat . _2 +~ 1000)+        (gen @'[3, 4] succ & snocMat . _2 +~ 1000)           @?= ((1 .: 2 .: 3 .| 4) .:: (5 .: 6 .: 7 .| 8) .|| (1009 .: 1010 .: 1011 .| 1012))     , testCase "consMat" $-        (gen @(NS '[5]) succ ^. consMat)+        (gen @'[5] succ ^. consMat)           @?= (1, 2 .: 3 .: 4 .| 5)     , testCase "snocMat" $-        (gen @(NS '[5]) succ ^. snocMat)+        (gen @'[5] succ ^. snocMat)           @?= (1 .: 2 .: 3 .| 4, 5)     , testCase "consMat" $-        (gen @(NS '[5]) succ & consMat . _1 +~ 1000)+        (gen @'[5] succ & consMat . _1 +~ 1000)           @?= (1001 .: 2 .: 3 .: 4 .| 5)     , testCase "consMat" $-        (gen @(NS '[5]) succ & consMat . _2 +~ 1000)+        (gen @'[5] succ & consMat . _2 +~ 1000)           @?= (1 .: 1002 .: 1003 .: 1004 .| 1005)     , testCase "snocMat" $-        (gen @(NS '[5]) succ & snocMat . _2 +~ 1000)+        (gen @'[5] succ & snocMat . _2 +~ 1000)           @?= (1 .: 2 .: 3 .: 4 .| 1005)     , testCase "snocMat" $-        (gen @(NS '[5]) succ & snocMat . _1 +~ 1000)+        (gen @'[5] succ & snocMat . _1 +~ 1000)           @?= (1001 .: 1002 .: 1003 .: 1004 .| 5)     , testCase "consMat" $-        (gen @(NS '[1]) succ ^. consMat)+        (gen @'[1] succ ^. consMat)           @?= (1, Eof1)     , testCase "snocMat" $-        (gen @(NS '[1]) succ ^. snocMat)+        (gen @'[1] succ ^. snocMat)           @?= (Eof1, 1)     , testCase "consMat" $-        (gen @(NS '[1, 4]) succ ^. consMat)+        (gen @'[1, 4] succ ^. consMat)           @?= (1 .: 2 .: 3 .| 4, EofN)     , testCase "snocMat" $-        (gen @(NS '[1, 4]) succ ^. snocMat)+        (gen @'[1, 4] succ ^. snocMat)           @?= (EofN, 1 .: 2 .: 3 .| 4)     , testCase "consMat" $-        (gen @(NS '[1, 4]) succ & consMat . _1 +~ 999)+        (gen @'[1, 4] succ & consMat . _1 +~ 999)           @?= se2 (1000 .: 1001 .: 1002 .| 1003)     , testCase "snocMat" $-        (gen @(NS '[1, 4]) succ & snocMat . _2 +~ 999)+        (gen @'[1, 4] succ & snocMat . _2 +~ 999)           @?= se2 (1000 .: 1001 .: 1002 .| 1003)     , testCase "swapMat" $-        swapMat @(NS '[2, 3, 1]) @(NS '[2, 1, 1]) (gen @(NS '[2, 3, 4]) id)+        swapMat @'[2, 3, 1] @'[2, 1, 1] (gen @'[2, 3, 4] id)           @?= mat' [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 20, 13, 14, 15, 16, 17, 18, 19, 12, 21, 22, 23]     , testCase "matToNestedVecC" $         nestedVecToMatC (matToNestedVecC m345)-          @?= m345 -- works without @(NS '[3,4,5]) cos @?= tells us the type+          @?= m345 -- works without @'[3,4,5] cos @?= tells us the type     , testCase "delete item from 1d mat'" $-        deleteRow @4 (mat' @(NS '[10]) [1 :: Int .. 10])+        deleteRow @4 (mat' @'[10] [1 :: Int .. 10])           @?= mat' [1, 2, 3, 5, 6, 7, 8, 9, 10]     , testCase "redim" $-        redim (mat' @(NS '[2, 3, 5]) [1 :: Int .. 30])-          @?= mat' @(NS '[6, 5]) [1 :: Int .. 30]+        redim (mat' @'[2, 3, 5] [1 :: Int .. 30])+          @?= mat' @'[6, 5] [1 :: Int .. 30]     , testCase "redim" $-        redim (mat' @(NS '[5, 9, 4]) [1 :: Int .. 180])-          @?= mat' @(NS '[3, 6, 10]) [1 :: Int .. 180]+        redim (mat' @'[5, 9, 4] [1 :: Int .. 180])+          @?= mat' @'[3, 6, 10] [1 :: Int .. 180]     , testCase "redim" $-        redim (mat' @(NS '[18]) [1 :: Int .. 18])-          @?= mat' @(NS '[3, 2, 3]) [1 :: Int .. 18]+        redim (mat' @'[18] [1 :: Int .. 18])+          @?= mat' @'[3, 2, 3] [1 :: Int .. 18]     , testCase "redim" $-        redim (mat' @(NS '[3, 2, 3]) [1 :: Int .. 18])-          @?= mat' @(NS '[18]) [1 :: Int .. 18]+        redim (mat' @'[3, 2, 3] [1 :: Int .. 18])+          @?= mat' @'[18] [1 :: Int .. 18]     , testCase "diagonal" $-        diagonal (gen @(NS '[4, 4]) succ)-          @?= mat' @(NS '[4]) [1, 6, 11, 16]+        diagonal (gen @'[4, 4] succ)+          @?= mat' @'[4] [1, 6, 11, 16]     , testCase "diagonal" $-        diagonal (gen @(NS '[3, 3, 4, 2]) succ)-          @?= mat' @(NS '[3, 4, 2]) [1, 2, 3, 4, 5, 6, 7, 8, 33, 34, 35, 36, 37, 38, 39, 40, 65, 66, 67, 68, 69, 70, 71, 72]+        diagonal (gen @'[3, 3, 4, 2] succ)+          @?= mat' @'[3, 4, 2] [1, 2, 3, 4, 5, 6, 7, 8, 33, 34, 35, 36, 37, 38, 39, 40, 65, 66, 67, 68, 69, 70, 71, 72]     , testCase "diagonal" $-        diagonal (mm @99)-          @?= mat' @(NS '[9]) [1, 11, 21, 31, 41, 51, 61, 71, 81]+        diagonal (mm @(NN 99))+          @?= mat' @'[9] [1, 11, 21, 31, 41, 51, 61, 71, 81]     , testCase "multMat" $-        multMat (mat' @(NS '[2, 5]) [1 :: Int .. 10]) (mat' @(NS '[5, 6]) [1 :: Int .. 30])-          @?= mat' @(NS '[2, 6]) [255, 270, 285, 300, 315, 330, 580, 620, 660, 700, 740, 780]+        multMat (mat' @'[2, 5] [1 :: Int .. 10]) (mat' @'[5, 6] [1 :: Int .. 30])+          @?= mat' @'[2, 6] [255, 270, 285, 300, 315, 330, 580, 620, 660, 700, 740, 780]     , testCase "universe1 enum" $-        toNonEmpty (finMatMatrix @(NS '[2, 3, 7]))-          @?= universe1 @(FinMat (NS '[2, 3, 7]))+        toNonEmpty (finMatMatrix @'[2, 3, 7])+          @?= universe1 @(FinMat '[2, 3, 7])     , testCase "finmat enum" $-        toList (finMatMatrix @(NS '[2, 3, 7]))+        toList (finMatMatrix @'[2, 3, 7])           @?= toList fmi237'     , testCase "D3" $         mat' @(D3 2 3 4) [1 :: Int .. 24]-          @?= mat' @(NS '[2, 3, 4]) [1 .. 24]+          @?= mat' @'[2, 3, 4] [1 .. 24]     , testCase "ixMat" $-        (mat' @(NS '[2, 3, 4]) [1 :: Int .. 24] & ixMat (finMatC @(NS '[2, 3, 1])) +~ 100)-          @?= mat' @(NS '[2, 3, 4]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 121, 22, 23, 24]+        (mat' @'[2, 3, 4] [1 :: Int .. 24] & ixMat (finMatC @'[2, 3, 1]) +~ 100)+          @?= mat' @'[2, 3, 4] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 121, 22, 23, 24]     , testCase "ixMat" $-        (mat' @(NS '[2, 3, 4]) [1 :: Int .. 24] & ixMat (finMatC @(NS '[2, 3, 4])) +~ 100)-          @?= mat' @(NS '[2, 3, 4]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 124]+        (mat' @'[2, 3, 4] [1 :: Int .. 24] & ixMat (finMatC @'[2, 3, 4]) +~ 100)+          @?= mat' @'[2, 3, 4] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 124]     , testCase "read" $-        (read @(Mat (D1 4) Int) $ show $ mat' @(NS '[4]) [1 :: Int .. 4])+        (read @(Mat (D1 4) Int) $ show $ mat' @'[4] [1 :: Int .. 4])           @?= (1 .: 2 .: 3 .| 4)     , testCase "read" $-        let m = gen' @(NS '[1]) id+        let m = gen' @'[1] id          in read (show m) @?= m     , testCase "read" $-        let m = gen' @(NS '[1, 1, 1, 1]) id+        let m = gen' @'[1, 1, 1, 1] id          in read (show m) @?= m     , testCase "read" $-        let m = gen' @(NS '[2, 3, 4, 5]) id+        let m = gen' @'[2, 3, 4, 5] id          in read (show m) @?= m     , testCase "read" $-        let m = gen' @(NS '[9, 2, 1]) id+        let m = gen' @'[9, 2, 1] id          in read (show m) @?= m     , testCase "read" $-        let m = gen' @(NS '[1, 2, 3]) id+        let m = gen' @'[1, 2, 3] id          in read (show m) @?= m     , testCase "read" $-        let m = ('x', True, ['a' .. 'z'], gen' @(NS '[1, 2, 3]) id, False)+        let m = ('x', True, ['a' .. 'z'], gen' @'[1, 2, 3] id, False)          in read (show m) @?= m     , testCase "read" $-        let m = mat' @(NS '[4, 5]) [1 :: Int .. 20]+        let m = mat' @'[4, 5] [1 :: Int .. 20]          in read @(Mat (D2 4 5) Int) (show m) @?= m     , testCase "read" $-        let m = mat' @(NS '[1, 2, 3, 4]) [1 :: Int .. 24]+        let m = mat' @'[1, 2, 3, 4] [1 :: Int .. 24]          in read (show m) @?= m     , testCase "read" $-        let m = toND @1 (mm @2352)+        let m = toND @1 (mm @(NN 2352))          in read (show m) @?= m     , testCase "read" $-        let m = toND @2 (mm @2352)+        let m = toND @2 (mm @(NN 2352))          in read (show m) @?= m     , testCase "read" $-        let m = mat' @(NS '[26]) ['a' .. 'z']+        let m = mat' @'[26] ['a' .. 'z']          in read (show m) @?= m     , testCase "sortByRows" $-        sortByRows (flip compare) (mat' @(NS '[4, 2]) [10, 9, 1, 2, 100, 200, 300, 400])+        sortByRows (flip compare) (mat' @'[4, 2] [10, 9, 1, 2, 100, 200, 300, 400])           @?= mat' [10, 9, 2, 1, 200, 100, 400, 300 :: Int]     , testCase "sortByT" $-        sortByT (flip compare) (mat' @(NS '[4]) [10 :: Int, 9, 1, 2])+        sortByT (flip compare) (mat' @'[4] [10 :: Int, 9, 1, 2])           @?= (10 .: 9 .: 2 .| 1)     , testCase "sortByT" $-        sortByT compare (mat' @(NS '[4]) [10 :: Int, 9, 1, 2])+        sortByT compare (mat' @'[4] [10 :: Int, 9, 1, 2])           @?= (1 .: 2 .: 9 .| 10)     , testCase "sortByRows" $-        sortByRows compare (mat' @(NS '[4, 2]) [10 :: Int, 9, 1, 2, 100, 200, 300, 400])+        sortByRows compare (mat' @'[4, 2] [10 :: Int, 9, 1, 2, 100, 200, 300, 400])           @?= mat' [9, 10, 1, 2, 100, 200, 300, 400]     , testCase "totuple" $         toTupleC (vec' "abc")@@ -385,173 +384,173 @@         fromTupleC (1, 2, 3 :: Int)           @?= 1 .: 2 .| 3     , testCase "consMat" $-        (mat' @(NS '[1]) "x" ^. consMat)+        (mat' @'[1] "x" ^. consMat)           @?= ('x', Eof1)     , testCase "consMat" $-        (mat' @(NS '[1, 1]) "x" ^. consMat)+        (mat' @'[1, 1] "x" ^. consMat)           @?= (se1 'x', EofN)     , testCase "consMat" $-        (mat' @(NS '[1, 1, 1]) "x" ^. consMat)+        (mat' @'[1, 1, 1] "x" ^. consMat)           @?= (se2 (se1 'x'), EofN)     , testCase "consMat" $-        (mat' @(NS '[4]) "xyz{" ^. consMat)+        (mat' @'[4] "xyz{" ^. consMat)           @?= ('x', vec' "yz{")     , testCase "consMat" $-        (mat' @(NS '[1, 4]) "xyz{" ^. consMat)+        (mat' @'[1, 4] "xyz{" ^. consMat)           @?= (mat' "xyz{", EofN)     , testCase "consMat" $-        (mat' @(NS '[4, 1]) "xyz{" ^. consMat)-          @?= (se1 'x', mat' @(NS '[3, 1]) "yz{")+        (mat' @'[4, 1] "xyz{" ^. consMat)+          @?= (se1 'x', mat' @'[3, 1] "yz{")     , testCase "consMat" $-        (mat' @(NS '[5, 3]) ['A' .. 'O'] ^. consMat)-          @?= (mat' @(NS '[3]) "ABC", mat' @(NS '[4, 3]) ['D' .. 'O'])+        (mat' @'[5, 3] ['A' .. 'O'] ^. consMat)+          @?= (mat' @'[3] "ABC", mat' @'[4, 3] ['D' .. 'O'])     , testCase "snocMat" $-        (mat' @(NS '[1]) "x" ^. snocMat)+        (mat' @'[1] "x" ^. snocMat)           @?= (Eof1, 'x')     , testCase "snocMat" $-        (mat' @(NS '[1, 1]) "x" ^. snocMat)+        (mat' @'[1, 1] "x" ^. snocMat)           @?= (EofN, se1 'x')     , testCase "snocMat" $-        (mat' @(NS '[1, 1, 1]) "x" ^. snocMat)+        (mat' @'[1, 1, 1] "x" ^. snocMat)           @?= (EofN, se2 (se1 'x'))     , testCase "snocMat" $-        (mat' @(NS '[4]) "xyz{" ^. snocMat)+        (mat' @'[4] "xyz{" ^. snocMat)           @?= (vec' "xyz", '{')     , testCase "snocMat" $-        (mat' @(NS '[1, 4]) "xyz{" ^. snocMat)+        (mat' @'[1, 4] "xyz{" ^. snocMat)           @?= (EofN, vec' "xyz{")     , testCase "snocMat" $-        (mat' @(NS '[4, 1]) "xyz{" ^. snocMat)-          @?= (mat' @(NS '[3, 1]) "xyz", se1 '{')+        (mat' @'[4, 1] "xyz{" ^. snocMat)+          @?= (mat' @'[3, 1] "xyz", se1 '{')     , testCase "snocMat" $-        (mat' @(NS '[5, 3]) ['A' .. 'O'] ^. snocMat)-          @?= (mat' @(NS '[4, 3]) ['A' .. 'L'], mat' @(NS '[3]) "MNO")+        (mat' @'[5, 3] ['A' .. 'O'] ^. snocMat)+          @?= (mat' @'[4, 3] ['A' .. 'L'], mat' @'[3] "MNO")     , testCase "field lens" $-        (mat' @(NS '[3, 3, 4]) [1 :: Int .. 36] ^. _r3 . _r1)+        (mat' @'[3, 3, 4] [1 :: Int .. 36] ^. _r3 . _r1)           @?= vec' @4 [25, 26, 27, 28]     , testCase "field lens" $-        (mat' @(NS '[3, 3, 4]) [1 :: Int .. 36] ^. _r3 . _r1)+        (mat' @'[3, 3, 4] [1 :: Int .. 36] ^. _r3 . _r1)           @?= vec' @4 [25, 26, 27, 28]     , testCase "field lens update" $-        (mat' @(NS '[2, 1, 4]) ['A' .. 'H'] & _r2 . _r1 . _r3 %~ toLower)+        (mat' @'[2, 1, 4] ['A' .. 'H'] & _r2 . _r1 . _r3 %~ toLower)           @?= mat' "ABCDEFgH"     , testCase "field lens" $-        (mat' @(NS '[7]) [1 :: Int .. 7] ^. _r3)+        (mat' @'[7] [1 :: Int .. 7] ^. _r3)           @?= 3     , testCase "field lens" $-        (mat' @(NS '[7, 4]) [1 :: Int .. 28] ^. _r3 . _r2)+        (mat' @'[7, 4] [1 :: Int .. 28] ^. _r3 . _r2)           @?= 10     , testCase "subsetRows" $-        subsetRows @2 @2 (gen @(NS '[2, 5]) succ)-          @?= mat' @(NS '[1, 5]) [6, 7, 8, 9, 10]+        subsetRows @2 @2 (gen @'[2, 5] succ)+          @?= mat' @'[1, 5] [6, 7, 8, 9, 10]     , testCase "subsetRows" $-        subsetRows @1 @2 (gen @(NS '[2, 5]) succ)-          @?= mat' @(NS '[2, 5]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]+        subsetRows @1 @2 (gen @'[2, 5] succ)+          @?= mat' @'[2, 5] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]     , testCase "subsetRows" $-        subsetRows @2 @4 (gen @(NS '[4, 5]) succ)-          @?= mat' @(NS '[3, 5]) [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]+        subsetRows @2 @4 (gen @'[4, 5] succ)+          @?= mat' @'[3, 5] [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]     , testCase "subsetRows" $-        subsetRows @2 @4 (gen @(NS '[5, 7]) succ)-          @?= mat' @(NS '[3, 7]) [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]+        subsetRows @2 @4 (gen @'[5, 7] succ)+          @?= mat' @'[3, 7] [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]     , testCase "subsetRows" $-        subsetRows @2 @2 (gen @(NS '[4]) succ)-          @?= mat' @(NS '[1]) [2]+        subsetRows @2 @2 (gen @'[4] succ)+          @?= mat' @'[1] [2]     , testCase "subsetRows" $-        subsetRows @2 @3 (gen @(NS '[4]) succ)-          @?= mat' @(NS '[2]) [2, 3]+        subsetRows @2 @3 (gen @'[4] succ)+          @?= mat' @'[2] [2, 3]     , testCase "subsetCols" $-        subsetCols @2 @4 (gen @(NS '[7, 6]) succ)-          @?= mat' @(NS '[7, 3]) [2, 3, 4, 8, 9, 10, 14, 15, 16, 20, 21, 22, 26, 27, 28, 32, 33, 34, 38, 39, 40]+        subsetCols @2 @4 (gen @'[7, 6] succ)+          @?= mat' @'[7, 3] [2, 3, 4, 8, 9, 10, 14, 15, 16, 20, 21, 22, 26, 27, 28, 32, 33, 34, 38, 39, 40]     , testCase "subsetCols" $-        subsetCols @1 @1 (gen @(NS '[3, 5]) succ)-          @?= mat' @(NS '[3, 1]) [1, 6, 11]+        subsetCols @1 @1 (gen @'[3, 5] succ)+          @?= mat' @'[3, 1] [1, 6, 11]     , testCase "subsetCols" $-        subsetCols @1 @2 (gen @(NS '[3, 5]) succ)-          @?= mat' @(NS '[3, 2]) [1, 2, 6, 7, 11, 12]+        subsetCols @1 @2 (gen @'[3, 5] succ)+          @?= mat' @'[3, 2] [1, 2, 6, 7, 11, 12]     , testCase "sliceC 35" $-        sliceC @(NS '[3, 5]) @(NS '[4, 6, 2]) (gen' id)-          @?= mat' @(NS '[2]) [[3, 5, 1], [3, 5, 2]]+        sliceC @'[3, 5] @'[4, 6, 2] (gen' id)+          @?= mat' @'[2] [[3, 5, 1], [3, 5, 2]]     , testCase "sliceC 3" $-        sliceC @(NS '[3]) @(NS '[4, 6, 2]) (gen' id)-          @?= mat' @(NS '[6, 2]) [[3, 1, 1], [3, 1, 2], [3, 2, 1], [3, 2, 2], [3, 3, 1], [3, 3, 2], [3, 4, 1], [3, 4, 2], [3, 5, 1], [3, 5, 2], [3, 6, 1], [3, 6, 2]]+        sliceC @'[3] @'[4, 6, 2] (gen' id)+          @?= mat' @'[6, 2] [[3, 1, 1], [3, 1, 2], [3, 2, 1], [3, 2, 2], [3, 3, 1], [3, 3, 2], [3, 4, 1], [3, 4, 2], [3, 5, 1], [3, 5, 2], [3, 6, 1], [3, 6, 2]]     , testCase "sliceC' 35" $ -- (3-1) * 6 + (5-1) == 16 cos all indexes start at 1-        sliceC' @(NS '[4, 6]) @(NS '[4, 6, 2]) (FinMatU 16 (_4P :| [_6P])) (gen' id)-          @?= mat' @(NS '[2]) [[3, 5, 1], [3, 5, 2]]+        sliceC' @'[4, 6] @'[4, 6, 2] (FinMatU 16 (_4P :| [_6P])) (gen' id)+          @?= mat' @'[2] [[3, 5, 1], [3, 5, 2]]     , testCase "sliceC' 3" $-        sliceC' @(NS '[4]) @(NS '[4, 6, 2]) (FinMatU 2 (_4P :| [])) (gen' id)-          @?= mat' @(NS '[6, 2]) [[3, 1, 1], [3, 1, 2], [3, 2, 1], [3, 2, 2], [3, 3, 1], [3, 3, 2], [3, 4, 1], [3, 4, 2], [3, 5, 1], [3, 5, 2], [3, 6, 1], [3, 6, 2]]+        sliceC' @'[4] @'[4, 6, 2] (FinMatU 2 (_4P :| [])) (gen' id)+          @?= mat' @'[6, 2] [[3, 1, 1], [3, 1, 2], [3, 2, 1], [3, 2, 2], [3, 3, 1], [3, 3, 2], [3, 4, 1], [3, 4, 2], [3, 5, 1], [3, 5, 2], [3, 6, 1], [3, 6, 2]]     , testCase "sliceC' 35" $-        map (\i -> sliceC' @(NS '[5, 3]) @(NS '[5, 3, 2]) (FinMatU i (_5P :| [_3P])) (gen succ)) [0 .. 14]+        map (\i -> sliceC' @'[5, 3] @'[5, 3, 2] (FinMatU i (_5P :| [_3P])) (gen succ)) [0 .. 14]           @?= [1 .| 2, 3 .| 4, 5 .| 6, 7 .| 8, 9 .| 10, 11 .| 12, 13 .| 14, 15 .| 16, 17 .| 18, 19 .| 20, 21 .| 22, 23 .| 24, 25 .| 26, 27 .| 28, 29 .| 30]     , testCase "sliceC' 2" $-        sliceC' @(NS '[1, 7, 3, 2, 6]) @(NS '[1, 7, 3, 2, 6]) (FinMatU 2 (_1P :| [_7P, _3P, _2P, _6P])) (gen' id)+        sliceC' @'[1, 7, 3, 2, 6] @'[1, 7, 3, 2, 6] (FinMatU 2 (_1P :| [_7P, _3P, _2P, _6P])) (gen' id)           @?= [1, 1, 1, 1, 3]     , testCase "sliceC' 43" $-        sliceC' @(NS '[1, 7, 3, 2, 6]) @(NS '[1, 7, 3, 2, 6]) (FinMatU 43 (_1P :| [_7P, _3P, _2P, _6P])) (gen' id)+        sliceC' @'[1, 7, 3, 2, 6] @'[1, 7, 3, 2, 6] (FinMatU 43 (_1P :| [_7P, _3P, _2P, _6P])) (gen' id)           @?= [1, 2, 1, 2, 2]     , testCase "sliceC 2" $-        sliceC @(NS '[1, 1, 1, 1, 3]) @(NS '[1, 7, 3, 2, 6]) (gen' id)+        sliceC @'[1, 1, 1, 1, 3] @'[1, 7, 3, 2, 6] (gen' id)           @?= [1, 1, 1, 1, 3]     , testCase "sliceC 43" $-        sliceC @(NS '[1, 2, 1, 2, 2]) @(NS '[1, 7, 3, 2, 6]) (gen' id)+        sliceC @'[1, 2, 1, 2, 2] @'[1, 7, 3, 2, 6] (gen' id)           @?= [1, 2, 1, 2, 2]     , testCase "sliceUpdateC' 0" $-        sliceUpdateC' @(NS '[4, 3]) @(NS '[4, 3, 2]) (FinMatU 0 (_4P :| [_3P])) (gen succ) (mat [999 ..])-          @?= mat' @(NS [4, 3, 2]) [999, 1000, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]+        sliceUpdateC' @'[4, 3] @'[4, 3, 2] (FinMatU 0 (_4P :| [_3P])) (gen succ) (mat [999 ..])+          @?= mat' @'[4, 3, 2] [999, 1000, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]     , testCase "sliceUpdateC' 1" $-        sliceUpdateC' @(NS '[4, 3]) @(NS '[4, 3, 2]) (FinMatU 1 (_4P :| [_3P])) (gen succ) (mat [999 ..])-          @?= mat' @(NS [4, 3, 2]) [1, 2, 999, 1000, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]+        sliceUpdateC' @'[4, 3] @'[4, 3, 2] (FinMatU 1 (_4P :| [_3P])) (gen succ) (mat [999 ..])+          @?= mat' @'[4, 3, 2] [1, 2, 999, 1000, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]     , testCase "sliceUpdateC' 2" $-        sliceUpdateC' @(NS '[4, 3]) @(NS '[4, 3, 2]) (FinMatU 2 (_4P :| [_3P])) (gen succ) (mat [999 ..])-          @?= mat' @(NS [4, 3, 2]) [1, 2, 3, 4, 999, 1000, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]+        sliceUpdateC' @'[4, 3] @'[4, 3, 2] (FinMatU 2 (_4P :| [_3P])) (gen succ) (mat [999 ..])+          @?= mat' @'[4, 3, 2] [1, 2, 3, 4, 999, 1000, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]     , testCase "sliceUpdateC' 5" $-        sliceUpdateC' @(NS '[4, 3]) @(NS '[4, 3, 2]) (FinMatU 5 (_4P :| [_3P])) (gen succ) (mat [999 ..])-          @?= mat' @(NS [4, 3, 2]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 999, 1000, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]+        sliceUpdateC' @'[4, 3] @'[4, 3, 2] (FinMatU 5 (_4P :| [_3P])) (gen succ) (mat [999 ..])+          @?= mat' @'[4, 3, 2] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 999, 1000, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]     , testCase "sliceUpdateC' 11" $-        sliceUpdateC' @(NS '[4, 3]) @(NS '[4, 3, 2]) (FinMatU 11 (_4P :| [_3P])) (gen succ) (mat [999 ..])-          @?= mat' @(NS [4, 3, 2]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 999, 1000]+        sliceUpdateC' @'[4, 3] @'[4, 3, 2] (FinMatU 11 (_4P :| [_3P])) (gen succ) (mat [999 ..])+          @?= mat' @'[4, 3, 2] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 999, 1000]     , testCase "sliceUpdateC 0" $-        sliceUpdateC @(NS '[1, 1]) @(NS '[4, 3, 2]) (gen succ) (mat [999 ..])-          @?= mat' @(NS [4, 3, 2]) [999, 1000, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]+        sliceUpdateC @'[1, 1] @'[4, 3, 2] (gen succ) (mat [999 ..])+          @?= mat' @'[4, 3, 2] [999, 1000, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]     , testCase "sliceUpdateC 1" $-        sliceUpdateC @(NS '[1, 2]) @(NS '[4, 3, 2]) (gen succ) (mat [999 ..])-          @?= mat' @(NS [4, 3, 2]) [1, 2, 999, 1000, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]+        sliceUpdateC @'[1, 2] @'[4, 3, 2] (gen succ) (mat [999 ..])+          @?= mat' @'[4, 3, 2] [1, 2, 999, 1000, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]     , testCase "sliceUpdateC 2" $-        sliceUpdateC @(NS '[1, 3]) @(NS '[4, 3, 2]) (gen succ) (mat [999 ..])-          @?= mat' @(NS [4, 3, 2]) [1, 2, 3, 4, 999, 1000, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]+        sliceUpdateC @'[1, 3] @'[4, 3, 2] (gen succ) (mat [999 ..])+          @?= mat' @'[4, 3, 2] [1, 2, 3, 4, 999, 1000, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]     , testCase "sliceUpdateC 5" $-        sliceUpdateC @(NS '[2, 3]) @(NS '[4, 3, 2]) (gen succ) (mat [999 ..])-          @?= mat' @(NS [4, 3, 2]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 999, 1000, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]+        sliceUpdateC @'[2, 3] @'[4, 3, 2] (gen succ) (mat [999 ..])+          @?= mat' @'[4, 3, 2] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 999, 1000, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]     , testCase "sliceUpdateC 11" $-        sliceUpdateC @(NS '[4, 3]) @(NS '[4, 3, 2]) (gen succ) (mat [999 ..])-          @?= mat' @(NS [4, 3, 2]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 999, 1000]+        sliceUpdateC @'[4, 3] @'[4, 3, 2] (gen succ) (mat [999 ..])+          @?= mat' @'[4, 3, 2] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 999, 1000]     , testCase "sliceUpdateC' 0" $-        sliceUpdateC' @(NS '[4, 3]) @(NS '[4, 3]) (FinMatU 0 (_4P :| [_3P])) (gen succ) 999-          @?= mat' @(NS '[4, 3]) [999, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]+        sliceUpdateC' @'[4, 3] @'[4, 3] (FinMatU 0 (_4P :| [_3P])) (gen succ) 999+          @?= mat' @'[4, 3] [999, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]     , testCase "sliceUpdateC' 7" $-        sliceUpdateC' @(NS '[4, 3]) @(NS '[4, 3]) (FinMatU 7 (_4P :| [_3P])) (gen succ) 999-          @?= mat' @(NS '[4, 3]) [1, 2, 3, 4, 5, 6, 7, 999, 9, 10, 11, 12]+        sliceUpdateC' @'[4, 3] @'[4, 3] (FinMatU 7 (_4P :| [_3P])) (gen succ) 999+          @?= mat' @'[4, 3] [1, 2, 3, 4, 5, 6, 7, 999, 9, 10, 11, 12]     , testCase "sliceUpdateC 0" $-        sliceUpdateC @(NS '[1, 1]) @(NS '[4, 3]) (gen succ) 999-          @?= mat' @(NS '[4, 3]) [999, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]+        sliceUpdateC @'[1, 1] @'[4, 3] (gen succ) 999+          @?= mat' @'[4, 3] [999, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]     , testCase "sliceUpdateC' 7" $-        sliceUpdateC @(NS '[3, 2]) @(NS '[4, 3]) (gen succ) 999-          @?= mat' @(NS '[4, 3]) [1, 2, 3, 4, 5, 6, 7, 999, 9, 10, 11, 12]+        sliceUpdateC @'[3, 2] @'[4, 3] (gen succ) 999+          @?= mat' @'[4, 3] [1, 2, 3, 4, 5, 6, 7, 999, 9, 10, 11, 12]     , testCase "sliceUpdateC' 0" $-        sliceUpdateC' @(NS '[7]) @(NS '[7]) (FinMatU 0 (_7P :| [])) (gen succ) 999-          @?= mat' @(NS '[7]) [999, 2, 3, 4, 5, 6, 7]+        sliceUpdateC' @'[7] @'[7] (FinMatU 0 (_7P :| [])) (gen succ) 999+          @?= mat' @'[7] [999, 2, 3, 4, 5, 6, 7]     , testCase "sliceUpdateC' 4" $-        sliceUpdateC' @(NS '[7]) @(NS '[7]) (FinMatU 4 (_7P :| [])) (gen succ) 999-          @?= mat' @(NS '[7]) [1, 2, 3, 4, 999, 6, 7]+        sliceUpdateC' @'[7] @'[7] (FinMatU 4 (_7P :| [])) (gen succ) 999+          @?= mat' @'[7] [1, 2, 3, 4, 999, 6, 7]     , testCase "sliceUpdateC 0" $-        sliceUpdateC @(NS '[1]) @(NS '[7]) (gen succ) 999-          @?= mat' @(NS '[7]) [999, 2, 3, 4, 5, 6, 7]+        sliceUpdateC @'[1] @'[7] (gen succ) 999+          @?= mat' @'[7] [999, 2, 3, 4, 5, 6, 7]     , testCase "sliceUpdateC 4" $-        sliceUpdateC @(NS '[5]) @(NS '[7]) (gen succ) 999-          @?= mat' @(NS '[7]) [1, 2, 3, 4, 999, 6, 7]+        sliceUpdateC @'[5] @'[7] (gen succ) 999+          @?= mat' @'[7] [1, 2, 3, 4, 999, 6, 7]     , testCase "toND" $-        toND @1 (gen' @(NS '[5, 3]) id)-          @?= mat' @(NS '[5])+        toND @1 (gen' @'[5, 3] id)+          @?= mat' @'[5]             ( map                 mat'                 [ [[1, 1], [1, 2], [1, 3]]@@ -562,88 +561,88 @@                 ]             )     , testCase "concatMat toND" $-        let m = gen' @(NS '[5, 3, 2]) id+        let m = gen' @'[5, 3, 2] id          in concatMat (toND @1 m) @?= m     , testCase "concatMat toND" $-        let m = gen' @(NS '[5, 3, 2]) id+        let m = gen' @'[5, 3, 2] id          in concatMat (toND @2 m) @?= m     , testCase "nonEmptyMatsToMat" $-        nonEmptyMatsToMat @10 (gen @(NS '[2, 5]) id :| [])+        nonEmptyMatsToMat @10 (gen @'[2, 5] id :| [])           @?= Left "LT: not enough elements: expected 10 found 1"     , testCase "nonEmptyMatsToMat" $-        nonEmptyMatsToMat @1 (gen @(NS '[2, 5]) id :| [])-          @?= Right (mat' @(NS '[1, 2, 5]) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])+        nonEmptyMatsToMat @1 (gen @'[2, 5] id :| [])+          @?= Right (mat' @'[1, 2, 5] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])     , testCase "nonEmptyMatsToMat" $-        nonEmptyMatsToMat @2 (gen @(NS '[2, 5]) succ :| [gen @(NS '[2, 5]) (+ 100)])-          @?= Right (mat' @(NS '[2, 2, 5]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109])+        nonEmptyMatsToMat @2 (gen @'[2, 5] succ :| [gen @'[2, 5] (+ 100)])+          @?= Right (mat' @'[2, 2, 5] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109])     , testCase "nonEmptyMatsToMat" $-        nonEmptyMatsToMat @1 (gen @(NS '[2, 5]) succ :| [gen @(NS '[2, 5]) (+ 100)])+        nonEmptyMatsToMat @1 (gen @'[2, 5] succ :| [gen @'[2, 5] (+ 100)])           @?= Left "GT: too many elements: expected 1"     , testCase "nonEmptyMatsToMat" $-        nonEmptyMatsToMat @3 (gen @(NS '[2, 5]) succ :| [gen @(NS '[2, 5]) (+ 100)])+        nonEmptyMatsToMat @3 (gen @'[2, 5] succ :| [gen @'[2, 5] (+ 100)])           @?= Left "LT: not enough elements: expected 3 found 2"     , testCase "cartesian" $-        cartesian (,) (gen @(NS '[4]) succ) (gen @(NS '[7]) (+ 101))-          @?= mat' @(NS '[4, 7]) [(1, 101), (1, 102), (1, 103), (1, 104), (1, 105), (1, 106), (1, 107), (2, 101), (2, 102), (2, 103), (2, 104), (2, 105), (2, 106), (2, 107), (3, 101), (3, 102), (3, 103), (3, 104), (3, 105), (3, 106), (3, 107), (4, 101), (4, 102), (4, 103), (4, 104), (4, 105), (4, 106), (4, 107)]+        cartesian (,) (gen @'[4] succ) (gen @'[7] (+ 101))+          @?= mat' @'[4, 7] [(1, 101), (1, 102), (1, 103), (1, 104), (1, 105), (1, 106), (1, 107), (2, 101), (2, 102), (2, 103), (2, 104), (2, 105), (2, 106), (2, 107), (3, 101), (3, 102), (3, 103), (3, 104), (3, 105), (3, 106), (3, 107), (4, 101), (4, 102), (4, 103), (4, 104), (4, 105), (4, 106), (4, 107)]     , testCase "bulkMat" $-        (mat' @(NS '[4, 4]) ['a' .. 'p'] ^. bulkMat (finMatC @(NS '[1, 2]) .: finMatC @(NS '[1, 4]) .| (finMatC @(NS '[4, 3]))))+        (mat' @'[4, 4] ['a' .. 'p'] ^. bulkMat (finMatC @'[1, 2] .: finMatC @'[1, 4] .| (finMatC @'[4, 3])))           @?= ('b' .: 'd' .| 'o')     , testCase "bulkMat" $-        (mat' @(NS '[4, 4]) ['a' .. 'p'] & bulkMat (finMatC @(NS '[1, 2]) .: finMatC @(NS '[1, 4]) .: finMatC @(NS '[3, 1]) .| (finMatC @(NS '[4, 3]))) %~ fmap toUpper)+        (mat' @'[4, 4] ['a' .. 'p'] & bulkMat (finMatC @'[1, 2] .: finMatC @'[1, 4] .: finMatC @'[3, 1] .| (finMatC @'[4, 3])) %~ fmap toUpper)           @?= (('a' .: 'B' .: 'c' .| 'D') .:: ('e' .: 'f' .: 'g' .| 'h') .:: ('I' .: 'j' .: 'k' .| 'l') .|| ('m' .: 'n' .: 'O' .| 'p'))     , testCase "findMatElems" $-        findMatElems ((== 0) . flip mod 5) (gen @(NS '[2, 3, 5]) succ)-          @?= [ (finMatC @(NS '[1, 1, 5]), 5)-              , (finMatC @(NS '[1, 2, 5]), 10)-              , (finMatC @(NS '[1, 3, 5]), 15)-              , (finMatC @(NS '[2, 1, 5]), 20)-              , (finMatC @(NS '[2, 2, 5]), 25)-              , (finMatC @(NS '[2, 3, 5]), 30)+        findMatElems ((== 0) . flip mod 5) (gen @'[2, 3, 5] succ)+          @?= [ (finMatC @'[1, 1, 5], 5)+              , (finMatC @'[1, 2, 5], 10)+              , (finMatC @'[1, 3, 5], 15)+              , (finMatC @'[2, 1, 5], 20)+              , (finMatC @'[2, 2, 5], 25)+              , (finMatC @'[2, 3, 5], 30)               ]     , testCase "permutationsMat" $         permutationsMat @4 "abcd"-          @?= mat' @(NS '[24, 4]) "abcdbacdcbadbcadcabdacbddcbacdbacbdadbcabdcabcdadabcadbcabdcdbacbdacbadcdacbadcbacdbdcabcdabcadb"+          @?= mat' @'[24, 4] "abcdbacdcbadbcadcabdacbddcbacdbacbdadbcabdcabcdadabcadbcabdcdbacbdacbadcdacbadcbacdbdcabcdabcadb"     , testCase "swapRow" $-        swapRow @2 @5 (gen @(NS '[6, 3, 2]) succ)-          @?= mat' @(NS '[6, 3, 2]) [1, 2, 3, 4, 5, 6, 25, 26, 27, 28, 29, 30, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 7, 8, 9, 10, 11, 12, 31, 32, 33, 34, 35, 36]+        swapRow @2 @5 (gen @'[6, 3, 2] succ)+          @?= mat' @'[6, 3, 2] [1, 2, 3, 4, 5, 6, 25, 26, 27, 28, 29, 30, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 7, 8, 9, 10, 11, 12, 31, 32, 33, 34, 35, 36]     , testCase "swapRow'" $-        swapRow' (FinU _3P _7P) (FinU _3P _7P) (gen @(NS '[7]) succ)-          @?= mat' @(NS '[7]) [1, 2, 3, 4, 5, 6, 7]+        swapRow' (FinU _3P _7P) (FinU _3P _7P) (gen @'[7] succ)+          @?= mat' @'[7] [1, 2, 3, 4, 5, 6, 7]     , testCase "swapRow'" $-        swapRow' (FinU _1P _7P) (FinU _7P _7P) (gen @(NS '[7]) succ)-          @?= mat' @(NS '[7]) [7, 2, 3, 4, 5, 6, 1]+        swapRow' (FinU _1P _7P) (FinU _7P _7P) (gen @'[7] succ)+          @?= mat' @'[7] [7, 2, 3, 4, 5, 6, 1]     , testCase "swapRow'" $-        swapRow' (FinU _3P _3P) (FinU _2P _3P) (gen @(NS '[3, 2, 2, 1]) succ)-          @?= mat' @(NS '[3, 2, 2, 1]) [1, 2, 3, 4, 9, 10, 11, 12, 5, 6, 7, 8]+        swapRow' (FinU _3P _3P) (FinU _2P _3P) (gen @'[3, 2, 2, 1] succ)+          @?= mat' @'[3, 2, 2, 1] [1, 2, 3, 4, 9, 10, 11, 12, 5, 6, 7, 8]     , testCase "ixSlice" $-        (gen' @(NS '[2, 4, 5]) id ^. ixSlice @(NS '[2]))-          @?= mat' @(NS '[4, 5]) [[2, 1, 1], [2, 1, 2], [2, 1, 3], [2, 1, 4], [2, 1, 5], [2, 2, 1], [2, 2, 2], [2, 2, 3], [2, 2, 4], [2, 2, 5], [2, 3, 1], [2, 3, 2], [2, 3, 3], [2, 3, 4], [2, 3, 5], [2, 4, 1], [2, 4, 2], [2, 4, 3], [2, 4, 4], [2, 4, 5]]+        (gen' @'[2, 4, 5] id ^. ixSlice @'[2])+          @?= mat' @'[4, 5] [[2, 1, 1], [2, 1, 2], [2, 1, 3], [2, 1, 4], [2, 1, 5], [2, 2, 1], [2, 2, 2], [2, 2, 3], [2, 2, 4], [2, 2, 5], [2, 3, 1], [2, 3, 2], [2, 3, 3], [2, 3, 4], [2, 3, 5], [2, 4, 1], [2, 4, 2], [2, 4, 3], [2, 4, 4], [2, 4, 5]]     , testCase "ixSlice" $-        (gen' @(NS '[2, 4, 5]) id ^. ixSlice @(NS '[2, 1]))-          @?= mat' @(NS '[5]) [[2, 1, 1], [2, 1, 2], [2, 1, 3], [2, 1, 4], [2, 1, 5]]+        (gen' @'[2, 4, 5] id ^. ixSlice @'[2, 1])+          @?= mat' @'[5] [[2, 1, 1], [2, 1, 2], [2, 1, 3], [2, 1, 4], [2, 1, 5]]     , testCase "ixSlice" $-        (gen' @(NS '[2, 4, 5]) id ^. ixSlice @(NS '[2, 1, 5]))+        (gen' @'[2, 4, 5] id ^. ixSlice @'[2, 1, 5])           @?= [2, 1, 5]     , testCase "gen'" $-        (gen @(NS '[4]) succ ^. _row @4)+        (gen @'[4] succ ^. _row @4)           @?= 4     , testCase "gen'" $-        (gen @(NS '[4, 3]) succ ^. _row @4)-          @?= mat' @(NS '[3]) [10, 11, 12]+        (gen @'[4, 3] succ ^. _row @4)+          @?= mat' @'[3] [10, 11, 12]     , testCase "rowsToMat" $-        rowsToMat (vec' @2 [_F1, _F1]) (mm @57)-          @?= mat' @(NS '[2, 7]) [1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7]+        rowsToMat (vec' @2 [_F1, _F1]) (mm @(NN 57))+          @?= mat' @'[2, 7] [1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7]     , testCase "rowsToMat" $-        rowsToMat (vec' @2 [_F1, _F3]) (mm @57)-          @?= mat' @(NS '[2, 7]) [1, 2, 3, 4, 5, 6, 7, 15, 16, 17, 18, 19, 20, 21]+        rowsToMat (vec' @2 [_F1, _F3]) (mm @(NN 57))+          @?= mat' @'[2, 7] [1, 2, 3, 4, 5, 6, 7, 15, 16, 17, 18, 19, 20, 21]     , testCase "rowsToMat" $-        rowsToMat (vec' @4 [_F1, _F3, _F5, _F3]) (mm @57)-          @?= mat' @(NS '[4, 7]) [1, 2, 3, 4, 5, 6, 7, 15, 16, 17, 18, 19, 20, 21, 29, 30, 31, 32, 33, 34, 35, 15, 16, 17, 18, 19, 20, 21]+        rowsToMat (vec' @4 [_F1, _F3, _F5, _F3]) (mm @(NN 57))+          @?= mat' @'[4, 7] [1, 2, 3, 4, 5, 6, 7, 15, 16, 17, 18, 19, 20, 21, 29, 30, 31, 32, 33, 34, 35, 15, 16, 17, 18, 19, 20, 21]     , testCase "_row'" $-        (mm @235 ^. _row' _F1)-          @?= mat @(NS '[3, 5]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]-    , testCase "_row'" $ (mm @7 ^. _row' _F5) @?= 5-    , testCase "_row'" $ (mm @17 ^. _row' _F1 . _row' _F7) @?= 7+        (mm @(NN 235) ^. _row' _F1)+          @?= mat @'[3, 5] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]+    , testCase "_row'" $ (mm @(NN 7) ^. _row' _F5) @?= 5+    , testCase "_row'" $ (mm @(NN 17) ^. _row' _F1 . _row' _F7) @?= 7     , testCase "sliceToFinMat" $         sliceToFinMat @(NN 123) @(NN 456)           @?= FinMatU 8 (_4P :| [_5P, _6P])@@ -666,58 +665,58 @@         sliceToFinMat @(NN 3) @(NN 4567)           @?= FinMatU 2 (_4P :| [])     , testCase "consMat" $-        (mm @5 & consMat %~ (show *** fmap show))-          @?= mat' @(5 ':| '[]) ["1", "2", "3", "4", "5"]+        (mm @(NN 5) & consMat %~ (show *** fmap show))+          @?= mat' @'[5] ["1", "2", "3", "4", "5"]     , testCase "consMat" $         let z = se1 'x' ^. consMat-         in z ^. from (consMat @(1 ':| '[])) @?= se1 'x'+         in z ^. from (consMat @'[1]) @?= se1 'x'     , testCase "consMat" $-        (('x', Eof1) ^. from (consMat @(1 ':| '[])))+        (('x', Eof1) ^. from (consMat @'[1]))           @?= se1 'x'     , testCase "nestedListToMatC" $-        nestedListToMatC @(2 ':| '[3, 5]) [[[1 :: Int, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]], [[16, 17, 18, 19, 20], [21, 22, 23, 24, 25], [26, 27, 28, 29, 30]]]-          @?= Right (mat' @(2 ':| '[3, 5]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])+        nestedListToMatC @'[2, 3, 5] [[[1 :: Int, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]], [[16, 17, 18, 19, 20], [21, 22, 23, 24, 25], [26, 27, 28, 29, 30]]]+          @?= Right (mat' @'[2, 3, 5] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30])     , testCase "nestedListToMatC" $-        nestedListToMatC @(3 ':| '[3, 5]) [[[1 :: Int, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]], [[16, 17, 18, 19, 20], [21, 22, 23, 24, 25], [26, 27, 28, 29, 30]]]+        nestedListToMatC @'[3, 3, 5] [[[1 :: Int, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]], [[16, 17, 18, 19, 20], [21, 22, 23, 24, 25], [26, 27, 28, 29, 30]]]           @?= Left "LT: not enough elements: expected 3 found 2"     , testCase "nestedListToMatC" $-        nestedListToMatC @(2 ':| '[3, 6]) [[[1 :: Int, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]], [[16, 17, 18, 19, 20], [21, 22, 23, 24, 25], [26, 27, 28, 29, 30]]]+        nestedListToMatC @'[2, 3, 6] [[[1 :: Int, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]], [[16, 17, 18, 19, 20], [21, 22, 23, 24, 25], [26, 27, 28, 29, 30]]]           @?= Left "not enough elements: expected 6 found 5"     , testCase "indexRow" $-        indexRow (fr $ fin @7 1) (mm' @73)+        indexRow (fr $ fin @7 1) (gen' @(NN 73) id)           @?= vec' [[1, 1], [1, 2], [1, 3]]     , testCase "indexRow" $-        indexRow (fr $ fin @7 3) (mm' @73)+        indexRow (fr $ fin @7 3) (gen' @(NN 73) id)           @?= vec' [[3, 1], [3, 2], [3, 3]]     , testCase "indexRow" $-        indexRow (fr $ fin @7 7) (mm' @73)+        indexRow (fr $ fin @7 7) (gen' @(NN 73) id)           @?= vec' [[7, 1], [7, 2], [7, 3]]     , testCase "readVec" $-        readVec @5 @Int (show (mm @5)) @?= [(vec' [1 .. 5], "")]+        readVec @5 @Int (show (mm @(NN 5))) @?= [(vec' [1 .. 5], "")]     , testCase "readMat2" $-        let m = mat' @(3 ':| '[7]) ['a' .. 'u']+        let m = mat' @'[3, 7] ['a' .. 'u']          in readMat2 @3 @7 @Char (show m ++ "xyz") @?= [(m, "xyz")]     , testCase "readVec" $-        let m = mat' @(7 ':| '[]) ['a' .. 'g']+        let m = mat' @'[7] ['a' .. 'g']          in readVec @7 @Char (show m ++ " xyz") @?= [(m, " xyz")]     , testCase "readMat2" $-        let m = mm @372+        let m = mm @(NN 372)          in readMat @(NN 372) @Int (show m ++ "xyz") @?= [(m, "xyz")] -- dont need type application but here we have inference     , testCase "readMat12" $-        let m = toVec (mm @372)+        let m = toVec (mm @(NN 372))          in readVec @3 @(Mat2 7 2 Int) (show m ++ "xyz") @?= [(m, "xyz")] -- dont need type application but here we have inference     , testCase "readMat3456" $-        let m = toMat2 (mm @3456)+        let m = toMat2 (mm @(NN 3456))          in readMat2 @3 @4 @(Mat2 5 6 Int) (show m ++ "xyz") @?= [(m, "xyz")] -- dont need type application but here we have inference     , testCase "readMat23456" $-        let m = toMat2 (mm @23456)-         in readMat2 @2 @3 @(Mat (4 ':| '[5, 6]) Int) (show m ++ "xyz") @?= [(m, "xyz")] -- dont need type application but here we have inference+        let m = toMat2 (mm @(NN 23456))+         in readMat2 @2 @3 @(Mat '[4, 5, 6] Int) (show m ++ "xyz") @?= [(m, "xyz")] -- dont need type application but here we have inference     , testCase "showMat" $-        showMat defShowOpts (mm @5) @?= "Vec@5 [1,2,3,4,5]"+        showMat defShowOpts (mm @(NN 5)) @?= "Vec@5 [1,2,3,4,5]"     , testCase "showMat" $-        showMat defShowOpts (mm @52) @?= "Mat2@(5,2)\n  [\n     [1,2],\n     [3,4],\n     [5,6],\n     [7,8],\n     [9,10]\n  ]\n"+        showMat defShowOpts (mm @(NN 52)) @?= "Mat2@(5,2)\n  [\n     [1,2],\n     [3,4],\n     [5,6],\n     [7,8],\n     [9,10]\n  ]\n"     , testCase "showMat" $-        showMat defShowOpts (mm @222) @?= "Mat@[2,2,2]\n  [\n     [\n        [1,2],\n        [3,4]\n     ],[\n        [5,6],\n        [7,8]\n     ]\n  ]\n"+        showMat defShowOpts (mm @(NN 222)) @?= "Mat@[2,2,2]\n  [\n     [\n        [1,2],\n        [3,4]\n     ],[\n        [5,6],\n        [7,8]\n     ]\n  ]\n"     , testCase "(.:)" $         se1 @Int 99           @?= vec' @1 [99]@@ -729,7 +728,7 @@           @?= mat2' @3 @2 [5 :: Int, 10, 15, 20, 25, 30]     , testCase "(.:)" $         se2 (5 .| 10 .:: 15 .| 20 .|| (25 .| 30))-          @?= mat' @(1 ':| '[3, 2]) [5 :: Int, 10, 15, 20, 25, 30]+          @?= mat' @'[1, 3, 2] [5 :: Int, 10, 15, 20, 25, 30]     , testCase "nestedListToMatValidated" $         let x = [[[[1 :: Int, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]], [[13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27]]]]          in nestedListToMatValidated @(NN 1234) x @?= Left "validateNestedListC: lengths=[4,4,4,4,4,7] ixes=[1P,2P,3P]"@@ -738,13 +737,13 @@          in nestedListToMatValidated @(NN 1234) x @?= Left "validateNestedListC: lengths=[4,4,4,4,4,0] ixes=[1P,2P,3P]"     , testCase "nestedListToMatValidated" $         let x = [[[[1 :: Int, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]], [[13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24]]]]-         in nestedListToMatValidated @(NN 1234) x @?= Right (mat' @(1 ':| '[2, 3, 4]) [1 .. 24])+         in nestedListToMatValidated @(NN 1234) x @?= Right (mat' @'[1, 2, 3, 4] [1 .. 24])     , testCase "matToNestedNonEmptyC" $-        matToNestedNonEmptyC (mm @234)+        matToNestedNonEmptyC (mm @(NN 234))           @?= ((1 :| [2 :: Int, 3, 4]) :| [5 :| [6, 7, 8], 9 :| [10, 11, 12]]) :| [(13 :| [14, 15, 16]) :| [17 :| [18, 19, 20], 21 :| [22, 23, 24]]]     , testCase "nestedNonEmptyToMatValidated" $         let x = ((1 :| [2 :: Int, 3, 4]) :| [5 :| [6, 7, 8], 9 :| [10, 11, 12]]) :| [(13 :| [14, 15, 16]) :| [17 :| [18, 19, 20], 21 :| [22, 23, 24]]]-         in nestedNonEmptyToMatValidated @(NN 234) x @?= Right (mat' @(2 ':| '[3, 4]) [1 .. 24])+         in nestedNonEmptyToMatValidated @(NN 234) x @?= Right (mat' @'[2, 3, 4] [1 .. 24])     , testCase "nestedNonEmptyToMatValidated" $         let x = ((1 :| [2 :: Int, 3, 4]) :| [5 :| [6, 7, 8], 9 :| [10, 11, 12]]) :| [(13 :| []) :| [17 :| [18, 19, 20], 21 :| [22, 23, 24]]]          in nestedNonEmptyToMatValidated @(NN 234) x @?= Left "validateNestedNonEmptyC: lengths=[4,4,4,1,4,4] ixes=[2,3]"@@ -752,7 +751,7 @@         let x = ((1 :| [2 :: Int, 3, 4]) :| [5 :| [6, 7, 8], 9 :| [10, 11, 12]]) :| [(13 :| [1 .. 20]) :| [17 :| [18, 19, 20], 21 :| [22, 23, 24]]]          in nestedNonEmptyToMatValidated @(NN 234) x @?= Left "validateNestedNonEmptyC: lengths=[4,4,4,21,4,4] ixes=[2,3]"     , testCase "tailsT" $-        tailsT (mm @52)+        tailsT (mm @(NN 52))           @?= mat' @(NN 52)             [ 1 :| [2, 3, 4, 5, 6, 7, 8, 9, 10]             , 2 :| [3, 4, 5, 6, 7, 8, 9, 10]@@ -766,7 +765,7 @@             , 10 :| []             ]     , testCase "initsT" $-        initsT (mm @52)+        initsT (mm @(NN 52))           @?= mat' @(NN 52)             [ 1 :| []             , 1 :| [2]@@ -799,7 +798,7 @@           @?= vec' @6 ["abcdef", "bcdef", "cdef", "def", "ef", "f"]     , testCase "postscanlMat" $         postscanlMat (flip (:)) [] (mat @(NN 222) ['a' ..])-          @?= mat' @(2 ':| '[2, 2]) ["a", "ba", "cba", "dcba", "edcba", "fedcba", "gfedcba", "hgfedcba"]+          @?= mat' @'[2, 2, 2] ["a", "ba", "cba", "dcba", "edcba", "fedcba", "gfedcba", "hgfedcba"]     , testCase "scanlVec" $         scanlVec (flip (:)) [] (vec @6 ['a' ..])           @?= vec' @7 ["", "a", "ba", "cba", "dcba", "edcba", "fedcba"]@@ -814,7 +813,7 @@           @?= ("fgh", vec' @5 [(0, 'e'), (1, 'd'), (2, 'c'), (3, 'b'), (4, 'a')])     , testCase "fillTraversable" $         fillTraversable @(MatN 234) (pure ()) [1 :: Int .. 40]-          @?= Right ([25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40], mat' @(2 ':| '[3, 4]) [1 .. 24])+          @?= Right ([25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40], mat' @'[2, 3, 4] [1 .. 24])     , testCase "toInteger1" $         toInteger1 (pure @(Mat2 4 2) EQ)           @?= 3280@@ -846,69 +845,77 @@         (maxBound :: Vec 10 Ordering)           @?= vec' @10 [GT, GT, GT, GT, GT, GT, GT, GT, GT, GT]     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Ordering)) 0-          @?= Right (mat' @(NS '[2, 5]) [LT, LT, LT, LT, LT, LT, LT, LT, LT, LT])+        fromInteger1 (minBound @(Mat '[2, 5] Ordering)) 0+          @?= Right (mat' @'[2, 5] [LT, LT, LT, LT, LT, LT, LT, LT, LT, LT])     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Ordering)) (-5)+        fromInteger1 (minBound @(Mat '[2, 5] Ordering)) (-5)           @?= Left "calcNextEnum:not defined for negative numbers"     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Int8)) 0-          @?= Right (mat' @(NS '[2, 5]) [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])+        fromInteger1 (minBound @(Mat '[2, 5] Int8)) 0+          @?= Right (mat' @'[2, 5] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0])     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Int8)) 128-          @?= Right (mat' @(NS '[2, 5]) [0, 0, 0, 0, 0, 0, 0, 0, 1, 0])+        fromInteger1 (minBound @(Mat '[2, 5] Int8)) 128+          @?= Right (mat' @'[2, 5] [0, 0, 0, 0, 0, 0, 0, 0, 1, 0])     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Int8)) (-129)-          @?= Right (mat' @(NS '[2, 5]) [0, 0, 0, 0, 0, 0, 0, 0, -1, 0])+        fromInteger1 (minBound @(Mat '[2, 5] Int8)) (-129)+          @?= Right (mat' @'[2, 5] [0, 0, 0, 0, 0, 0, 0, 0, -1, 0])     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Ordering)) 23-          @?= Right (mat' @(NS '[2, 5]) [LT, LT, LT, LT, LT, LT, LT, GT, EQ, GT])+        fromInteger1 (minBound @(Mat '[2, 5] Ordering)) 23+          @?= Right (mat' @'[2, 5] [LT, LT, LT, LT, LT, LT, LT, GT, EQ, GT])     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Ordering)) 59049+        fromInteger1 (minBound @(Mat '[2, 5] Ordering)) 59049           @?= Left "cap=(0,59048):padL: negative fill: would need to truncate the data"     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Ordering)) 59048-          @?= Right (mat' @(NS '[2, 5]) [GT, GT, GT, GT, GT, GT, GT, GT, GT, GT])+        fromInteger1 (minBound @(Mat '[2, 5] Ordering)) 59048+          @?= Right (mat' @'[2, 5] [GT, GT, GT, GT, GT, GT, GT, GT, GT, GT])     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Int8)) 99999999999999-          @?= Right (mat' @(NS '[2, 5]) [0, 0, 0, 22, 94, 49, 3, 104, 127, 127])+        fromInteger1 (minBound @(Mat '[2, 5] Int8)) 99999999999999+          @?= Right (mat' @'[2, 5] [0, 0, 0, 22, 94, 49, 3, 104, 127, 127])     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Ordering)) (-1)+        fromInteger1 (minBound @(Mat '[2, 5] Ordering)) (-1)           @?= Left "calcNextEnum:not defined for negative numbers"     , testCase "toInteger1" $-        toInteger1 (mat' @(NS '[2, 5]) [LT, LT, LT, LT, LT, LT, LT, LT, LT, LT])+        toInteger1 (mat' @'[2, 5] [LT, LT, LT, LT, LT, LT, LT, LT, LT, LT])           @?= 0     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Int8)) 99999999999999999999+        fromInteger1 (minBound @(Mat '[2, 5] Int8)) 99999999999999999999           @?= Right (mat2' @2 @5 [10, 107, 99, 87, 69, 86, 24, 63, 127, 127])     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Int8)) 99999999999999999999999+        fromInteger1 (minBound @(Mat '[2, 5] Int8)) 99999999999999999999999           @?= Left "cap=(-1276136419117121619200,1180591620717411303423):padL: negative fill: would need to truncate the data"     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Int8)) 1180591620717411303423+        fromInteger1 (minBound @(Mat '[2, 5] Int8)) 1180591620717411303423           @?= Right (mat2' @2 @5 [127, 127, 127, 127, 127, 127, 127, 127, 127, 127])     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Int8)) 1180591620717411303424+        fromInteger1 (minBound @(Mat '[2, 5] Int8)) 1180591620717411303424           @?= Left "cap=(-1276136419117121619200,1180591620717411303423):padL: negative fill: would need to truncate the data"     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Int8)) (-1276136419117121619200)+        fromInteger1 (minBound @(Mat '[2, 5] Int8)) (-1276136419117121619200)           @?= Right (mat2' @2 @5 [-128, -128, -128, -128, -128, -128, -128, -128, -128, -128])     , testCase "fromInteger1" $-        fromInteger1 (minBound @(Mat (2 ':| '[5]) Int8)) (-1276136419117121619201)+        fromInteger1 (minBound @(Mat '[2, 5] Int8)) (-1276136419117121619201)           @?= Left "cap=(-1276136419117121619200,1180591620717411303423):padL: negative fill: would need to truncate the data"++    , testCase "lenses mixed" $+       mm @(NN 1234) ^. _r1 . _r1 . _c2 . snocMat . _1 . consMat+        @?= (2,vec @1 [6])++    , testCase "lenses mixed" $+        mm @(NN 734) ^. _c3 . snocMat . _1 . _c4 . _r5+        @?= 60     ]  suiteCheckers :: TestTree suiteCheckers =   testGroup     "TestMat Checkers"-    [ adj' False 10 500 10 $ TQ.testProperties "mat [2,3,4]" (checkersToProps (testLawsMat @(NS '[2, 3, 4])))-    , adj' False 10 500 10 $ TQ.testProperties "mat [5]" (checkersToProps (testLawsMat' @(NS '[5])))-    , adj' False 10 500 10 $ TQ.testProperties "mat [1]" (checkersToProps (testLawsMat' @(NS '[1])))-    , adj' False 10 500 10 $ TQ.testProperties "mat [1,5]" (checkersToProps (testLawsMat' @(NS '[1, 5])))+    [ adj' False 10 500 10 $ TQ.testProperties "mat [2,3,4]" (checkersToProps (testLawsMat @'[2, 3, 4]))+    , adj' False 10 500 10 $ TQ.testProperties "mat [5]" (checkersToProps (testLawsMat' @'[5]))+    , adj' False 10 500 10 $ TQ.testProperties "mat [1]" (checkersToProps (testLawsMat' @'[1]))+    , adj' False 10 500 10 $ TQ.testProperties "mat [1,5]" (checkersToProps (testLawsMat' @'[1, 5]))     ] -fmi237' :: NonEmpty (FinMat (NS '[2, 3, 7]))+fmi237' :: NonEmpty (FinMat '[2, 3, 7]) fmi237' = frp $ traverse (nonEmptyToFinMat <=< toPositives) fmi237  fmi237 :: NonEmpty (NonEmpty Int)