summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.md13
-rw-r--r--LICENSE30
-rw-r--r--README.md58
-rw-r--r--Setup.hs2
-rw-r--r--data-default-instances-unordered-containers.cabal53
-rw-r--r--src/Data/Default/Instances/UnorderedContainers.hs45
6 files changed, 201 insertions, 0 deletions
diff --git a/ChangeLog.md b/ChangeLog.md
new file mode 100644
index 0000000..a4060d8
--- /dev/null
+++ b/ChangeLog.md
@@ -0,0 +1,13 @@
+# ChangeLog / ReleaseNotes
+
+
+## Version 0.0.1
+
+* First public release.
+* Uploaded to [Hackage][]: <http://hackage.haskell.org/package/data-default-instances-unordered-containers-0.0.1>
+
+
+
+[Hackage]:
+ http://hackage.haskell.org/
+ "HackageDB (or just Hackage) is a collection of releases of Haskell packages."
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..25594a6
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+Copyright (c) 2015-2016, Peter Trško
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Peter Trško nor the names of other
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..0addeb9
--- /dev/null
+++ b/README.md
@@ -0,0 +1,58 @@
+# data-default-instances-unordered-containers
+
+[![Hackage](http://img.shields.io/hackage/v/data-default-instances-unordered-containers.svg)][data-default-instances-unordered-containers]
+[![Hackage Dependencies](https://img.shields.io/hackage-deps/v/data-default-instances-unordered-containers.svg)](http://packdeps.haskellers.com/reverse/data-default-instances-unordered-containers)
+[![Haskell Programming Language](https://img.shields.io/badge/language-Haskell-blue.svg)][Haskell.org]
+[![BSD3 License](http://img.shields.io/badge/license-BSD3-brightgreen.svg)][tl;dr Legal: BSD3]
+
+[![Build](https://travis-ci.org/trskop/data-default-extra.svg)](https://travis-ci.org/trskop/data-default-extra)
+
+
+# Description
+
+`Default` instances for types defined in [unordered-containers][] package:
+
+```Haskell
+instance Default (HashMap k v) where
+ def = HashMap.empty
+
+instance Default (HashSet a) where
+ def = HashSet.empty
+```
+
+This package is intended to be used in conjunction with [data-default][]
+package or directly with [data-default-class][] package.
+
+
+## License
+
+The BSD 3-Clause License, see [LICENSE][] file for details.
+
+
+## Contributions
+
+Contributions, pull requests and bug reports are welcome! Please don't be
+afraid to contact author using GitHub or by e-mail.
+
+
+[data-default]:
+ https://hackage.haskell.org/package/data-default
+ "Hackage: data-default"
+[data-default-class]:
+ https://hackage.haskell.org/package/data-default-class
+ "Hackage: data-default-class"
+[data-default-instances-unordered-containers]:
+ https://hackage.haskell.org/package/data-default-instances-unordered-containers
+ "Package data-default-instances-unordered-containers on Hackage"
+[Haskell.org]:
+ http://www.haskell.org
+ "The Haskell Programming Language"
+[LICENSE]:
+ https://github.com/trskop/data-default-extra/blob/master/instances-unordered-containers/LICENSE
+ "License of data-default-instances-unordered-containers package."
+[tl;dr Legal: BSD3]:
+ https://tldrlegal.com/license/bsd-3-clause-license-%28revised%29
+ "BSD 3-Clause License (Revised)"
+[unordered-containers]:
+ https://hackage.haskell.org/package/unordered-containers
+ "Hackage: unordered-containers"
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
index 0000000..9a994af
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/data-default-instances-unordered-containers.cabal b/data-default-instances-unordered-containers.cabal
new file mode 100644
index 0000000..4585dae
--- /dev/null
+++ b/data-default-instances-unordered-containers.cabal
@@ -0,0 +1,53 @@
+name: data-default-instances-unordered-containers
+version: 0.0.1
+synopsis: Default instances for unordered-containers.
+description:
+ Orphan instances for @Default@ type class, which is defined in package
+ <https://hackage.haskell.org/package/data-default-class data-default-class>.
+ .
+ Following @Default@ instances are provided:
+ .
+ > instance Default (HashMap k v) where
+ > def = empty
+ >
+ > instance Default (HashSet a) where
+ > def = empty
+
+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) 2015-2016, Peter Trško
+category: Data
+build-type: Simple
+cabal-version: >=1.10
+
+extra-source-files:
+ ChangeLog.md
+ , README.md
+
+library
+ hs-source-dirs: src
+ exposed-modules: Data.Default.Instances.UnorderedContainers
+
+ default-language: Haskell2010
+ other-extensions: NoImplicitPrelude
+
+ build-depends:
+ unordered-containers >=0.1.3 && <0.3
+ -- ^ Version 0.1.3 is the first one that introduced HashSet.
+
+ , data-default-class ==0.0.*
+
+ 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: unordered-containers-v0.0.1
diff --git a/src/Data/Default/Instances/UnorderedContainers.hs b/src/Data/Default/Instances/UnorderedContainers.hs
new file mode 100644
index 0000000..87fead9
--- /dev/null
+++ b/src/Data/Default/Instances/UnorderedContainers.hs
@@ -0,0 +1,45 @@
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+-- |
+-- Module: $HEADER$
+-- Description: Default instances for HashMap and HashSet.
+-- Copyright: (c) 2015, Peter Trško
+-- License: BSD3
+--
+-- Maintainer: peter.trsko@gmail.com
+-- Stability: experimental
+-- Portability: NoImplicitPrelude
+--
+-- 'Default' instances for 'HashMap' and 'HashSet' from
+-- <https://hackage.haskell.org/package/unordered-containers unordered-containers>
+-- package.
+module Data.Default.Instances.UnorderedContainers
+ ( -- $providedInstances
+ )
+ where
+
+import Data.HashMap.Strict (HashMap)
+import qualified Data.HashMap.Strict as HashMap (empty)
+import Data.HashSet (HashSet)
+import qualified Data.HashSet as HashSet (empty)
+
+import Data.Default.Class (Default(def))
+
+
+instance Default (HashMap k v) where
+ def = HashMap.empty
+
+instance Default (HashSet a) where
+ def = HashSet.empty
+
+-- $providedInstances
+--
+-- Following instances are provided:
+--
+-- @
+-- instance 'Default' ('HashMap' k v) where
+-- 'def' = 'HashMap.empty'
+--
+-- instance 'Default' ('HashSet' a) where
+-- 'def' = 'HashSet.empty'
+-- @