vec: Vec: length-indexed (sized) list
This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.
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:
naive: with explicit recursion. It's simple, constraint-less, yet slow.
pull: using
Fin n -> a
representation, which fuses well, but makes some programs hard to write. Anddata-family: which allows lazy pattern matching
inline: which exploits how GHC dictionary inlining works, unrolling recursion if the size of
Vec
is known statically.
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
linear has
V
type, which usesVector
fromvector
package as backing store.Vec
is a real GADT, but tries to provide as many useful instances (uptolens
).vector-sized Great package using
GHC.TypeLits
. Current version (0.6.1.0) usesfinite-typelits
andInt
indexes.sized-vector depends on
singletons
package.vec
isn't light on dependencies either, but try to provide wide GHC support.sized also depends on a
singletons
package. TheSized f n a
type is generalisation oflinear
'sV
for anyListLike
.clash-prelude is a kitchen sink package, which has
CLaSH.Sized.Vector
module. Also depends onsingletons
.
Properties
Versions | 0, 0.1, 0.1.1, 0.1.1.1, 0.1.1.1, 0.2, 0.3, 0.4, 0.4.1, 0.5, 0.5.1 |
---|---|
Change log | ChangeLog.md |
Dependencies | adjunctions (>=4.4 && <4.5), base (>=4.7 && <4.13), base-compat (>=0.9.3 && <0.11), deepseq (>=1.3.0.2 && <1.5), distributive (>=0.5.3 && <0.7), fin (>=0.1 && <0.2), hashable (>=1.2.7.0 && <1.4), lens (>=4.16 && <4.18), 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 2019-07-07T11:14:43Z |
Modules
[Index] [Quick Jump]
Downloads
- vec-0.1.1.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
Package maintainers
For package maintainers and hackage trustees