[Haskell-cafe] Vectors, vector spaces and type-level Haskell

Stuart Hungerford stuart.hungerford at gmail.com
Mon Oct 4 03:35:19 UTC 2021


Greetings Haskellers,

I'd like to model in Haskell two-dimensional vectors that "belong to"
or "have an ambient space of" a two dimensional vector space. I'm also
ignoring for now the issue of which field the vector space is over. I
realize this is not strictly necessary to just start using 2D vectors,
but I would like to bring the vector space in as a first class
concept.

Looking at for example this approach:
https://hackage.haskell.org/package/linear-1.21.7/docs/Linear-V2.html,
I get the impression this is likely to need some kind of type-level
construct?  e.g. type families or type-level literals?

I haven't started learning yet about Haskell type-level programming so
I thought I'd ask for advice first to see how this could be done
idiomatically in Haskell either with or without type-level concepts.

TIA,

Stu


More information about the Haskell-Cafe mailing list