-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathvec.cabal
More file actions
191 lines (170 loc) · 5.58 KB
/
vec.cabal
File metadata and controls
191 lines (170 loc) · 5.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
cabal-version: 2.2
name: vec
version: 0.5.1
x-revision: 2
synopsis: Vec: length-indexed (sized) list
category: Data, Dependent Types
description:
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. And
.
* __data-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](https://hackage.haskell.org/package/fin), i.e. not @GHC.TypeLits@, for indexes.
.
For @lens@ or @optics@ support see [vec-lens](https://hackage.haskell.org/package/vec-lens) and [vec-optics](https://hackage.haskell.org/package/vec-optics) packages respectively.
.
See [Hasochism: the pleasure and pain of dependently typed haskell programming](https://doi.org/10.1145/2503778.2503786)
by Sam Lindley and Conor McBride for answers to /how/ and /why/.
Read [APLicative Programming with Naperian Functors](https://doi.org/10.1007/978-3-662-54434-1_21)
by Jeremy Gibbons for (not so) different ones.
.
=== Similar packages
.
* [linear](https://hackage.haskell.org/package/linear) has 'V' type,
which uses 'Vector' from @vector@ package as backing store.
@Vec@ is a real GADT, but tries to provide as many useful instances (upto @lens@).
.
* [vector-sized](https://hackage.haskell.org/package/vector-sized)
Great package using @GHC.TypeLits@. Current version (0.6.1.0) uses
@finite-typelits@ and @Int@ indexes.
.
* [sized-vector](https://hackage.haskell.org/package/sized-vector) depends
on @singletons@ package. @vec@ isn't light on dependencies either,
but try to provide wide GHC support.
.
* [fixed-vector](https://hackage.haskell.org/package/fixed-vector)
.
* [sized](https://hackage.haskell.org/package/sized) also depends
on a @singletons@ package. The @Sized f n a@ type is generalisation of
@linear@'s @V@ for any @ListLike@.
.
* [clash-prelude](https://hackage.haskell.org/package/clash-prelude)
is a kitchen sink package, which has @CLaSH.Sized.Vector@ module.
Also depends on @singletons@.
homepage: https://github.com/phadej/vec
bug-reports: https://github.com/phadej/vec/issues
license: BSD-3-Clause
license-file: LICENSE
author: Oleg Grenrus <oleg.grenrus@iki.fi>
maintainer: Oleg.Grenrus <oleg.grenrus@iki.fi>
copyright: (c) 2017-2021 Oleg Grenrus
build-type: Simple
extra-source-files: ChangeLog.md
tested-with:
GHC ==8.6.5
|| ==8.8.4
|| ==8.10.7
|| ==9.0.2
|| ==9.2.8
|| ==9.4.8
|| ==9.6.6
|| ==9.8.4
|| ==9.10.1
|| ==9.12.2
source-repository head
type: git
location: https://github.com/phadej/vec.git
subdir: vec
flag adjunctions
description: Depend on @adjunctions@ to provide its instances
manual: True
default: True
flag distributive
description:
Depend on @distributive@ to provide its instances. Turning on, disables @adjunctions@ too.
manual: True
default: True
flag semigroupoids
description:
Depend on @semigroupoids@ to provide its instances, and `traverse1`.
manual: True
default: True
library
default-language: Haskell2010
ghc-options: -Wall -fprint-explicit-kinds
hs-source-dirs: src
exposed-modules:
Data.Vec.DataFamily.SpineStrict
Data.Vec.Lazy
Data.Vec.Lazy.Inline
Data.Vec.Pull
other-modules:
Control.Lens.Yocto
SafeCompat
-- GHC boot libs
build-depends:
, base >=4.12.0.0 && <4.22
, deepseq >=1.4.4.0 && <1.6
, transformers >=0.5.6.2 && <0.7
-- siblings
build-depends: fin ^>=0.3.1
-- other dependencies
build-depends:
, boring ^>=0.2.2
, hashable ^>=1.4.4.0 || ^>=1.5.0.0
, indexed-traversable ^>=0.1.4
, QuickCheck ^>=2.14.2 || ^>=2.15.0.1
if flag(distributive)
build-depends: distributive ^>=0.6.2
if flag(adjunctions)
build-depends: adjunctions ^>=4.4.2
if flag(semigroupoids)
build-depends: semigroupoids ^>=6.0.1
other-extensions:
CPP
FlexibleContexts
GADTs
TypeOperators
if impl(ghc >=9.0)
-- these flags may abort compilation with GHC-8.10
-- https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3295
ghc-options: -Winferred-safe-imports -Wmissing-safe-haskell-mode
x-docspec-extra-packages: void
x-docspec-extra-packages: lens
test-suite inspection
type: exitcode-stdio-1.0
main-is: Main.hs
other-modules:
Inspection
Inspection.DataFamily.SpineStrict
ghc-options: -Wall -fprint-explicit-kinds
hs-source-dirs: test
default-language: Haskell2010
build-depends:
, base
, fin
, inspection-testing ^>=0.5.0.3 || ^>=0.6
, tagged
, vec
benchmark bench
type: exitcode-stdio-1.0
main-is: Bench.hs
ghc-options: -Wall -fprint-explicit-kinds
hs-source-dirs: bench
default-language: Haskell2010
other-modules: DotProduct
build-depends:
, base
, criterion ^>=1.6.3.0
, fin
, vec
, vector