I've always wanted someone to write a type-safe framework for tensor manipulation that
a) fully leverages first-class types, and
b) is ergonomic

Maybe that someone has to be me; I wrote a proof-of-concept in Idris and used it to implement transformers:
github.com/bgavran/TypeSafe_Te

It supports standard tensors, and *non-cubical* tensors given by applicative functors, as well tensor indexing.

So if you have a 't : Tensor [BinTree, BinTree] Double' and you index outside of the shape of the tree, you get a *compile-time* error.

Indexing is powered by containers, transposition by Naperian functors, and non-cubical tensors by applicative functors (see cs.ox.ac.uk/people/jeremy.gibb)

I was surprised how far one can go with this idea, and how pleasant it was in general to implement all of this in Idris.

What all of this does is enable you to implement the *generalised transformers* as described here (glaive-research.org/2025/02/11) - transformers that operate on not just vectors, but potentially trees, and other structures too.

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mathstodon.xyz/users/bgavran/statuses/114466210408333576 on your instance and quote it. (Note that quoting is not supported in Mastodon.)