Created
December 19, 2014 01:55
-
-
Save gabro/f631c6ab4a02b4aee201 to your computer and use it in GitHub Desktop.
dependent type Matrix with implicit conversion from Vect m (Vect n a)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Matrix | |
data Matrix : Nat -> Nat -> Type -> Type where | |
Matr : Vect m (Vect n a) -> Matrix n m a | |
(+) : Matrix n m a -> Vect n a -> Matrix n (m + 1) a | |
(+) (Matr rows) row = Matr (rows ++ [row]) | |
implicit vectVectToMatr : Vect m (Vect n a) -> Matrix n m a | |
vectVectToMatr = Matr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
example usage:
and of course you can't add mismatching rows