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

Henning Thielemann lemming at henning-thielemann.de
Mon Oct 4 22:14:14 UTC 2021


On Tue, 5 Oct 2021, Stuart Hungerford wrote:

> On Mon, Oct 4, 2021 at 2:35 PM Stuart Hungerford
> <stuart.hungerford at gmail.com> wrote:
>
>> 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.
>
> After much googling and searching Hackage, I found these references
> useful (note that "vectors" in these references sometimes refer to
> arrays of fixed length and sometimes to elements of a vector space):
>
> https://mmhaskell.com/machine-learning/dependent-types
>
> https://serokell.io/blog/dimensions-and-haskell-introduction
>
> https://hackage.haskell.org/package/linear-1.20.4/docs/Linear-V2.html
>
> http://mstksg.github.io/hmatrix/Numeric-LinearAlgebra-Static.html

You may also use
   https://hackage.haskell.org/package/comfort-array

with
   https://hackage.haskell.org/package/comfort-array-0.5.1/docs/Data-Array-Comfort-Shape.html#t:Enumeration
or
   https://hackage.haskell.org/package/comfort-array-shape-0.0/docs/Data-Array-Comfort-Shape-Static.html

and
   https://hackage.haskell.org/package/lapack

But it will be overkill for two-dimensional vectors.


More information about the Haskell-Cafe mailing list