data-default-extra: A class for types with a default value.
An alternative to
data-default package, that
provides a lot of additional instances for Default
type class.
Default
type class provides a default value (def
) of a type. In case when
a particluar type has an instance for Monoid
, then the default value should
be mempty
, otherwise it can cause a great deal of confusion.
One must understand, that Default
type class, has no axioms associated with
it. Its purpose is to minimize:
Number of imports.
Number of introduced definitions that are part of an API.
Complexity of building more complicated "default values" out of simpler "default values".
Cognitive overhead. (Reduction of cognitive overhead is partially a consequence of reducing above issues.)
As one may notice, most of the listed problems, that Default
type class
tries to solve, to various degrees of success, are for human benefit, and not
theoretically founded. Because of this, please always try hard to define
sensible instances of Default
. Most importantly, document what def
means
for particular type, and always check that def
is sensible, by testing it
on a real world sample of human beings, one is not a big enough sample.
That said, using Default
may not always be a good idea. If it breaks
people's mental model, or theoretical models with real axioms, then just
don't use it.
[Skip to Readme]
Flags
Automatic Flags
Name | Description | Default |
---|---|---|
with-bytestring | Provide instances for (lazy and strict) ByteString, ByteString Builder and for ShortByteString. | Enabled |
with-case-insensitive | Provide instance for CI (Case Insensitive) type wrapper. | Enabled |
with-containers | Provide instances for Set, Map, IntMap, IntSet, Seq, and Tree. | Enabled |
with-dlist | Provide instance for DList type. | Disabled |
with-text | Provide instance for (strict and lazy) Text and Text Builder. | Enabled |
with-old-locale | Provide instance for TimeLocale type. | Enabled |
with-unordered-containers | Provide instances for HashMap and HashSet. | Enabled |
with-vector | Provide instances for various (boxed and unboxed) Vector types. | Enabled |
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
Downloads
- data-default-extra-0.1.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
Versions [RSS] | 0.0.1, 0.1.0 |
---|---|
Change log | ChangeLog.md |
Dependencies | base (<6), data-default-class (>=0.0.1 && <0.2), data-default-instances-bytestring (>=0.0 && <0.1), data-default-instances-case-insensitive (>=0.0 && <0.1), data-default-instances-containers (>=0.0 && <0.1), data-default-instances-dlist (>=0.0 && <0.1), data-default-instances-new-base (>=0.0.1 && <0.2), data-default-instances-old-locale (>=0.0 && <0.1), data-default-instances-text (>=0.0 && <0.1), data-default-instances-unordered-containers (>=0.0 && <0.1), data-default-instances-vector (>=0.0 && <0.1), ghc-prim [details] |
License | BSD-3-Clause |
Copyright | (c) 2016-2017 Peter Trško |
Author | Peter Trško |
Maintainer | peter.trsko@gmail.com |
Category | Data |
Home page | https://github.com/trskop/data-default-extra |
Bug tracker | https://github.com/trskop/data-default-extra/issues |
Source repo | head: git clone git://github.com/trskop/data-default-extra.git this: git clone git://github.com/trskop/data-default-extra.git(tag class-0.1.2) |
Uploaded | by PeterTrsko at 2017-01-05T22:23:05Z |
Distributions | |
Reverse Dependencies | 2 direct, 2 indirect [details] |
Downloads | 2031 total (6 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Last success reported on 2017-01-05 [all 1 reports] |