on master help sign in
distinct Module instance for matrices

This is a less general solution that the ideal one which would be: Module a b => Module a (Vect n b) where (<#>) r m = map (r<#>) m But results in 'overlapping instance' error.

commite612c84ab0f42c9eb7931603241742d81eea0c47 authorCliff Harvey <cs.hbar@gmail.com> dateTue 4 Nov 2014, 11:25 (12 years ago) parent6764cff
1 file changed+4
libs/base/Data/Matrix.idr+4
libs/base/Data/Matrix.idr+4
@@ -42,6 +42,10 @@ instance Field a => Field (Vect n a) where
4242instance RingWithUnity a => Module a (Vect n a) where
4343 (<#>) r v = map (r <*>) v
4444
45+instance RingWithUnity a => Module a (Vect n (Vect l a)) where
46+ (<#>) r m = map (r <#>) m
47+-- should be Module a b => Module a (Vect n b), but results in 'overlapping instance'
48+
4549-----------------------------------------------------------------------
4650-- (Ring) Vector functions
4751-----------------------------------------------------------------------