name: data-default-extra
version: 0.1.0
synopsis: A class for types with a default value.
description:
An alternative to
<https://hackage.haskell.org/package/data-default 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.
homepage: https://github.com/trskop/data-default-extra
bug-reports: https://github.com/trskop/data-default-extra/issues
license: BSD3
license-file: LICENSE
author: Peter Trško
maintainer: peter.trsko@gmail.com
copyright: (c) 2016-2017 Peter Trško
category: Data
build-type: Simple
cabal-version: >=1.10
extra-source-files: ChangeLog.md, README.md
flag with-bytestring
description:
Provide instances for (lazy and strict) ByteString, ByteString Builder and
for ShortByteString.
default: True
manual: False
flag with-case-insensitive
description:
Provide instance for CI (Case Insensitive) type wrapper.
default: True
manual: False
flag with-containers
description:
Provide instances for Set, Map, IntMap, IntSet, Seq, and Tree.
default: True
manual: False
flag with-dlist
description: Provide instance for DList type.
default: False
manual: False
flag with-text
description:
Provide instance for (strict and lazy) Text and Text Builder.
default: True
manual: False
flag with-old-locale
description: Provide instance for TimeLocale type.
-- Old locale is part of GHC distribution, doesn't make sense to have it
-- turned off.
default: True
manual: False
flag with-unordered-containers
description: Provide instances for HashMap and HashSet.
default: True
manual: False
flag with-vector
description:
Provide instances for various (boxed and unboxed) Vector types.
default: True
manual: False
library
hs-source-dirs: src
exposed-modules:
Data.Default
, Data.Default.Generic
-- other-modules:
default-language: Haskell2010
other-extensions:
CPP
, FlexibleContexts
, NoImplicitPrelude
, TypeOperators
build-depends:
base <6
, data-default-class >=0.0.1 && <0.2
, data-default-instances-new-base >=0.0.1 && <0.2
if impl(ghc <7.6)
-- GHC.Generics moved from ghc-prim to base with GHC 7.6 release.
build-depends: ghc-prim
if flag(with-bytestring)
build-depends: data-default-instances-bytestring ==0.0.*
cpp-options: -DWITH_bytestring
if flag(with-case-insensitive)
build-depends: data-default-instances-case-insensitive ==0.0.*
cpp-options: -DWITH_case_insensitive
if flag(with-containers)
build-depends: data-default-instances-containers ==0.0.*
cpp-options: -DWITH_containers
if flag(with-dlist)
build-depends: data-default-instances-dlist ==0.0.*
cpp-options: -DWITH_dlist
if flag(with-text)
build-depends: data-default-instances-text ==0.0.*
cpp-options: -DWITH_text
if flag(with-old-locale)
build-depends: data-default-instances-old-locale ==0.0.*
cpp-options: -DWITH_old_locale
if flag(with-unordered-containers)
build-depends: data-default-instances-unordered-containers ==0.0.*
cpp-options: -DWITH_unordered_containers
if flag(with-vector)
build-depends: data-default-instances-vector ==0.0.*
cpp-options: -DWITH_vector
ghc-options: -Wall -fwarn-tabs
source-repository head
type: git
location: git://github.com/trskop/data-default-extra.git
source-repository this
type: git
location: git://github.com/trskop/data-default-extra.git
tag: class-0.1.2