forked from kowainik/relude
-
Notifications
You must be signed in to change notification settings - Fork 0
/
relude.cabal
277 lines (242 loc) · 11.3 KB
/
relude.cabal
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
cabal-version: 3.0
name: relude
version: 1.0.0.1
synopsis: Safe, performant, user-friendly and lightweight Haskell Standard Library
description:
@__relude__@ is an alternative prelude library. If you find the default
@Prelude@ unsatisfying, despite its advantages, consider using @relude@
instead.
== Relude goals and design principles
* __Productivity.__ You can be more productive with a "non-standard" standard
library, and @relude@ helps you with writing safer and more
efficient code faster.
* __Total programming__. Usage of [/partial functions/](https://www.reddit.com/r/haskell/comments/5n51u3/why_are_partial_functions_as_in_head_tail_bad/)
can lead to unexpected bugs and runtime exceptions in pure
code. The types of partial functions lie about their behaviour. And
even if it is not always possible to rely only on total functions,
@relude@ strives to encourage best-practices and reduce the
chances of introducing a bug.
+---------------------------------+--------------------------------------------+
| __Partial__ | __Total__ |
+=================================+============================================+
| @head :: [a] -> a@ | @head :: NonEmpty a -> a@ |
+---------------------------------+--------------------------------------------+
| @tail :: [a] -> [a]@ | @tail :: NonEmpty a -> [a]@ |
+---------------------------------+--------------------------------------------+
| @read :: Read a => String -> a@ | @readMaybe :: Read a => String -> Maybe a@ |
+---------------------------------+--------------------------------------------+
| @fromJust :: Maybe a -> a@ | @fromMaybe :: a -> Maybe a -> a@ |
+---------------------------------+--------------------------------------------+
* __Type-safety__. We use the /"make invalid states unrepresentable"/ motto as one
of our guiding principles. If it is possible, we express this concept through the
types.
/Example:/ @ whenNotNull :: Applicative f => [a] -> (NonEmpty a -> f ()) -> f () @
* __Performance.__ We prefer @Text@ over @[String](https://www.reddit.com/r/haskell/comments/29jw0s/whats_wrong_with_string/)@,
use space-leaks-free functions (e.g. our custom performant @sum@ and @product@),
introduce @\{\-\# INLINE \#\-\}@ and @\{\-\# SPECIALIZE \#\-\}@ pragmas where
appropriate, and make efficient container types
(e.g. @Map@, @HashMap@, @Set@) more accessible.
* __Minimalism__ (low number of dependencies). We do not force users of
@relude@ to stick to any specific lens or text formatting or logging
library. Where possible, @relude@ depends only on boot libraries.
The [Dependency graph](https://raw.githubusercontent.com/kowainik/relude/main/relude-dependency-graph.png)
of @relude@ can give you a clearer picture.
* __Convenience__. Despite minimalism, we want to bring commonly used
types and functions into scope, and make available functions easier
to use. Some examples of conveniences:
1. No need to add @containers@, @unordered-containers@, @text@
and @bytestring@ to dependencies in your @.cabal@ file to
use the main API of these libraries
2. No need to import types like @NonEmpty@, @Text@, @Set@, @Reader[T]@, @MVar@, @STM@
3. Functions like @liftIO@, @fromMaybe@, @sortWith@ are available by default as well
4. @IO@ actions are lifted to @MonadIO@
* __Excellent documentation.__
1. Tutorial
2. Migration guide from @Prelude@
3. Haddock for every function with examples tested by
[doctest](http://hackage.haskell.org/package/doctest).
4. Documentation regarding [internal module structure](http://hackage.haskell.org/package/relude/docs/Relude.html)
5. @relude@-specific [HLint](http://hackage.haskell.org/package/hlint) rules: @[.hlint.yaml](https://github.com/kowainik/relude/blob/main/.hlint.yaml)@
* __User-friendliness.__ Anyone should be able to quickly migrate to @relude@. Only
some basic familiarity with the common libraries like @text@ and @containers@
should be enough (but not necessary).
* __Exploration.__ We have space to experiment with new ideas and proposals
without introducing breaking changes. @relude@ uses the approach with
@Extra.*@ modules which are not exported by default. The chosen approach makes it quite
easy for us to provide new functionality without breaking anything and let
the users decide to use it or not.
homepage: https://github.com/kowainik/relude
bug-reports: https://github.com/kowainik/relude/issues
license: MIT
license-file: LICENSE
author: Dmitrii Kovanikov, Veronika Romashkina, Stephen Diehl, Serokell
maintainer: Kowainik <[email protected]>
copyright: 2016 Stephen Diehl, 2016-2018 Serokell, 2018-2021 Kowainik
category: Prelude
stability: stable
build-type: Simple
extra-doc-files: CHANGELOG.md
README.md
tested-with: GHC == 8.2.2
GHC == 8.4.4
GHC == 8.6.5
GHC == 8.8.4
GHC == 8.10.4
GHC == 9.0.1
source-repository head
type: git
location: [email protected]:kowainik/relude.git
common common-options
build-depends: base >= 4.10 && < 4.16
ghc-options: -Wall
-Wcompat
-Widentities
-Wincomplete-uni-patterns
-Wincomplete-record-updates
-fwarn-implicit-prelude
-Wredundant-constraints
-fhide-source-paths
if impl(ghc >= 8.4)
ghc-options: -Wmissing-export-lists
-Wpartial-fields
if impl(ghc >= 8.8)
ghc-options: -Wmissing-deriving-strategies
if impl(ghc >= 8.10)
ghc-options: -Wunused-packages
default-language: Haskell2010
default-extensions: InstanceSigs
NoImplicitPrelude
OverloadedStrings
ScopedTypeVariables
TypeApplications
library
import: common-options
hs-source-dirs: src
exposed-modules:
Relude
Relude.Applicative
Relude.Base
Relude.Bool
Relude.Bool.Guard
Relude.Bool.Reexport
Relude.Container
Relude.Container.One
Relude.Container.Reexport
Relude.Debug
Relude.DeepSeq
Relude.Enum
Relude.Exception
Relude.File
Relude.Foldable
Relude.Foldable.Fold
Relude.Foldable.Reexport
Relude.Function
Relude.Functor
Relude.Functor.Fmap
Relude.Functor.Reexport
Relude.Lifted
Relude.Lifted.Concurrent
Relude.Lifted.Exit
Relude.Lifted.File
Relude.Lifted.IORef
Relude.Lifted.Terminal
Relude.Lifted.Handle
Relude.Lifted.Env
Relude.List
Relude.List.NonEmpty
Relude.List.Reexport
Relude.Monad
Relude.Monad.Either
Relude.Monad.Maybe
Relude.Monad.Reexport
Relude.Monad.Trans
Relude.Monoid
Relude.Nub
Relude.Numeric
Relude.Print
Relude.String
Relude.String.Conversion
Relude.String.Reexport
-- not exported by default
Relude.Extra
Relude.Extra.Bifunctor
Relude.Extra.CallStack
Relude.Extra.Enum
Relude.Extra.Foldable
Relude.Extra.Foldable1
Relude.Extra.Group
Relude.Extra.Lens
Relude.Extra.Map
Relude.Extra.Newtype
Relude.Extra.Tuple
Relude.Extra.Type
Relude.Unsafe
reexported-modules:
-- containers
, Data.IntMap.Lazy
, Data.IntMap.Strict
, Data.IntSet
, Data.Map.Lazy
, Data.Map.Strict
, Data.Set
, Data.Sequence
, Data.Tree
-- unordered-containers
, Data.HashMap.Lazy
, Data.HashMap.Strict
, Data.HashSet
-- text
, Data.Text
, Data.Text.IO
, Data.Text.Lazy
, Data.Text.Lazy.IO
, Data.Text.Read
-- bytestring
, Data.ByteString
, Data.ByteString.Builder
, Data.ByteString.Lazy
, Data.ByteString.Short
build-depends: bytestring >= 0.10 && < 0.12
, containers >= 0.5.7 && < 0.7
, deepseq ^>= 1.4
, ghc-prim >= 0.4.0.0 && < 0.8
, hashable >= 1.2 && < 1.4
, mtl ^>= 2.2
, stm >= 2.4 && < 2.6
, text ^>= 1.2
, transformers ^>= 0.5
, unordered-containers >= 0.2.7 && < 0.3
test-suite relude-test
import: common-options
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
other-modules: Test.Relude.Gen
Test.Relude.Container.One
Test.Relude.Property
build-depends: relude
, bytestring
, containers
, text
, hedgehog ^>= 1.0
ghc-options: -threaded
test-suite relude-doctest
import: common-options
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Doctest.hs
build-depends: relude
, doctest
, Glob
ghc-options: -threaded
benchmark relude-benchmark
import: common-options
type: exitcode-stdio-1.0
hs-source-dirs: benchmark
main-is: Main.hs
build-depends: relude
, criterion
, unordered-containers
ghc-options: -threaded
-rtsopts
-with-rtsopts=-N