Vectors, matrices and tensors for free

Fully representable type safe vectors, matrices and tensors defined as functor compositions without using dependent types so that all natural transfomations are coming for free.

Let me know if you have questions on some non-trivial operatons you can perform on those.

This is how they are defined: https://github.com/iokasimov/ya-literal/blob/main/Ya/Literal/Linear.hs

Source code with snippets are attached so you can play with them: https://github.com/iokasimov/ya-snippets/blob/main/Ya/Snippets/linear-algebra-primitives.hs

8 Likes