Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions password-instances/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog for `password-instances`

## 3.1.0.0

- Added cabal flags (`aeson`, `http-api-data`, `persistent`) to make
dependencies optional. All flags default to `True`.
- Added compile-time error if all flags are disabled.
- Split into dedicated packages
[#87](https://github.com/cdepillabout/password/pull/87)
- and add flags to parametrize dependencies
[#89](https://github.com/cdepillabout/password/pull/89)

## 3.0.0.0

- The `password-instances` library now depends on the new
Expand Down
34 changes: 30 additions & 4 deletions password-instances/password-instances.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 1.12

name: password-instances
version: 3.0.0.0
version: 3.1.0.0
category: Security
synopsis: typeclass instances for password package
description: A library providing typeclass instances for common libraries for the types from the password package.
Expand All @@ -21,6 +21,21 @@ source-repository head
type: git
location: https://github.com/cdepillabout/password

flag aeson
description: Enable instances for Aeson
default: True
manual: True

flag http-api-data
description: Enable instances for HTTP API Data
default: True
manual: True

flag persistent
description: Enable instances for Persistent
default: True
manual: True

custom-setup
setup-depends:
base >= 4.9 && < 5
Expand All @@ -35,10 +50,21 @@ library
Paths_password_instances
build-depends:
base >= 4.9 && < 5
, password-aeson
, password-http-api-data
, password-persistent
ghc-options:
-Wall
default-language:
Haskell2010
default-extensions:
CPP
if flag(aeson)
build-depends:
password-aeson
cpp-options: -DFLAG_AESON
if flag(http-api-data)
build-depends:
password-http-api-data
cpp-options: -DFLAG_HTTP_API_DATA
if flag(persistent)
build-depends:
password-persistent
cpp-options: -DFLAG_PERSISTENT
12 changes: 12 additions & 0 deletions password-instances/src/Data/Password/Instances.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ See the "Data.Password.Types" module for more information.

module Data.Password.Instances (module E) where

#if !defined(FLAG_AESON) && !defined(FLAG_HTTP_API_DATA) && !defined(FLAG_PERSISTENT)
#error "At least one of the flags (aeson, http-api-data, persistent) must be enabled"
#endif

#ifdef FLAG_AESON
import Data.Password.Aeson as E
#endif

#ifdef FLAG_HTTP_API_DATA
import Data.Password.HttpApiData as E
#endif

#ifdef FLAG_PERSISTENT
import Data.Password.Persistent as E
#endif
Loading