Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/0xd34df00d/idris2-indexed-vect
Indexed vectors for Idris!
https://github.com/0xd34df00d/idris2-indexed-vect
dependent-types idris idris2
Last synced: about 1 month ago
JSON representation
Indexed vectors for Idris!
- Host: GitHub
- URL: https://github.com/0xd34df00d/idris2-indexed-vect
- Owner: 0xd34df00d
- Created: 2023-07-30T00:04:23.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-08-12T22:03:49.000Z (over 1 year ago)
- Last Synced: 2024-12-01T13:26:36.244Z (about 2 months ago)
- Topics: dependent-types, idris, idris2
- Language: Idris
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**indexed-vect** — like `Data.Vect`, but with element types indexed by their position in the vector
As a simplest example, consider a vector of `5` elements
where each element also carries a proof that it is equal to its index in the vector.
This is unexpressable with the standard `Data.Vect`, but we can do this:
```idris
sample : IVect 5 (\idx => (n ** n = idx))
sample = [ (0 ** Refl), (1 ** Refl), (2 ** Refl), (3 ** Refl), (4 ** Refl) ]
```Merely copying `Data.Vect`'s API is not a good idea since some APIs won't work,
so if there's a particular use case that this library misses,
please open an issue, and hopefully we'll be able to implement that!