vec: Vec: length-indexed (sized) list

[ bsd3, data, dependent-types, library ] [ Propose Tags ]

This package provides length-indexed (sized) lists, also known as vectors.

data Vec n a where
    VNil  :: Vec 'Nat.Z a
    (:::) :: a -> Vec n a -> Vec ('Nat.S n) a

The functions are implemented in four flavours:

As best approach depends on the application, vec doesn't do any magic transformation. Benchmark your code.

This package uses fin, i.e. not GHC.TypeLits, for indexes.

See Hasochism: the pleasure and pain of dependently typed haskell programming by Sam Lindley and Conor McBride for answers to how and why. Read APLicative Programming with Naperian Functors by Jeremy Gibbons for (not so) different ones.

Similar packages

Versions [faq] 0, 0.1, 0.1.1, 0.1.1.1, 0.2
Change log ChangeLog.md
Dependencies adjunctions (==4.4.*), base (>=4.6 && <4.14), base-compat (>=0.9.3 && <0.12), deepseq (>=1.3.0.1 && <1.5), distributive (>=0.5.3 && <0.7), fin (==0.1.*), hashable (>=1.2.7.0 && <1.4), lens (>=4.16 && <4.19), semigroupoids (>=5.2.2 && <5.4), semigroups (>=0.18.4 && <0.20), transformers (>=0.3.0.0 && <0.6) [details]
License BSD-3-Clause
Copyright (c) 2017-2019 Oleg Grenrus
Author Oleg Grenrus <oleg.grenrus@iki.fi>
Maintainer Oleg.Grenrus <oleg.grenrus@iki.fi>
Category Data, Dependent Types
Home page https://github.com/phadej/vec
Bug tracker https://github.com/phadej/vec/issues
Source repo head: git clone https://github.com/phadej/vec.git
Uploaded by phadej at Mon Oct 7 13:32:04 UTC 2019
Distributions LTSHaskell:0.1.1, NixOS:0.2, Stackage:0.1.1
Downloads 1223 total (141 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-10-07 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees