Skip to content

Commit

Permalink
version 0.1.1.1: NFData instances (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheshirrrrrr authored and ozzzzz committed May 20, 2019
1 parent 689584b commit bd5aa6d
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [0.1.1.1] - 2019-05-20
### Added
- `NFData` instances for configs.

## [0.1.1.0] - 2018-11-21
### Added
- Lens for configs;
Expand Down
9 changes: 5 additions & 4 deletions bcd-config.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: bcd-config
version: 0.1.1.0
version: 0.1.1.1
synopsis: Library to get config.
description: Library to get config to different systems
homepage: https://github.com/biocad/bcd-config#readme
Expand Down Expand Up @@ -34,13 +34,14 @@ library
, System.BCD.Config.FileSystem
, System.BCD.Config.BioSources
build-depends: base >=4.7 && <5
, containers
, text
, unordered-containers
, aeson
, aeson-casing
, aeson-picker
, containers
, deepseq
, lens
, text
, unordered-containers
default-language: Haskell2010
default-extensions: DeriveGeneric
, OverloadedStrings
Expand Down
6 changes: 5 additions & 1 deletion src/System/BCD/Config/BioSources.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ module System.BCD.Config.BioSources
, FromJsonConfig (..)
) where

import Control.DeepSeq (NFData)
import Data.Aeson.Picker ((|--))
import GHC.Generics (Generic)
import System.BCD.Config (FromJsonConfig (..), getConfigText)

-- | This class contains information where to find files that are related to
-- semantic common used library [bio-sources](https://github.com/biocad/bio-sources).
-- That library includes dihedral angles, kmers, ideal aminoacids and functions to work with them.
newtype BioSourcesConfig = BioSourcesConfig { bioSourcesPath :: FilePath }
deriving (Show, Read, Eq)
deriving (Show, Read, Eq, Generic)

instance NFData BioSourcesConfig

instance FromJsonConfig BioSourcesConfig where
fromJsonConfig = do
Expand Down
6 changes: 5 additions & 1 deletion src/System/BCD/Config/FileSystem.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ module System.BCD.Config.FileSystem
, FromJsonConfig (..)
) where

import Control.DeepSeq (NFData)
import Data.Aeson.Picker ((|--))
import Data.HashMap.Strict (HashMap)
import GHC.Generics (Generic)
import System.BCD.Config (FromJsonConfig (..), getConfigText)

newtype FileSystemConfig = FileSystemConfig (HashMap String FilePath)
deriving (Show, Read, Eq)
deriving (Show, Read, Eq, Generic)

instance NFData FileSystemConfig

instance FromJsonConfig FileSystemConfig where
fromJsonConfig = do
Expand Down
4 changes: 3 additions & 1 deletion src/System/BCD/Config/Mongo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module System.BCD.Config.Mongo
, descr
) where

import Control.DeepSeq (NFData)
import Control.Lens (makeLenses)
import Data.Aeson (FromJSON (..), ToJSON (..),
genericParseJSON, genericToJSON)
Expand All @@ -20,7 +21,6 @@ import Data.Text (Text)
import GHC.Generics (Generic)
import System.BCD.Config (FromJsonConfig (..), getConfigText)


data MongoConfig = MongoConfig { _host :: String
, _port :: Int
, _user :: String
Expand All @@ -32,6 +32,8 @@ data MongoConfig = MongoConfig { _host :: String

makeLenses ''MongoConfig

instance NFData MongoConfig

instance ToJSON MongoConfig where
toJSON = genericToJSON $ aesonDrop 1 snakeCase
instance FromJSON MongoConfig where
Expand Down
3 changes: 3 additions & 0 deletions src/System/BCD/Config/Mysql.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module System.BCD.Config.Mysql
, descr
) where

import Control.DeepSeq (NFData)
import Control.Lens (makeLenses)
import Data.Aeson (FromJSON (..), ToJSON (..),
genericParseJSON, genericToJSON)
Expand All @@ -27,6 +28,8 @@ data MysqlConfig = MysqlConfig { _host :: String

makeLenses ''MysqlConfig

instance NFData MysqlConfig

instance ToJSON MysqlConfig where
toJSON = genericToJSON $ aesonDrop 1 snakeCase
instance FromJSON MysqlConfig where
Expand Down
3 changes: 3 additions & 0 deletions src/System/BCD/Config/Neo4j.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module System.BCD.Config.Neo4j
, descr
) where

import Control.DeepSeq (NFData)
import Control.Lens (makeLenses)
import Data.Aeson (FromJSON (..), ToJSON (..),
genericParseJSON, genericToJSON)
Expand All @@ -33,6 +34,8 @@ data Neo4jConfig = Neo4jConfig { _host :: String

makeLenses ''Neo4jConfig

instance NFData Neo4jConfig

instance ToJSON Neo4jConfig where
toJSON = genericToJSON $ aesonDrop 1 snakeCase
instance FromJSON Neo4jConfig where
Expand Down
3 changes: 3 additions & 0 deletions src/System/BCD/Config/Postgres.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module System.BCD.Config.Postgres
, descr
) where

import Control.DeepSeq (NFData)
import Control.Lens (makeLenses)
import Data.Aeson (FromJSON (..), ToJSON (..),
genericParseJSON, genericToJSON)
Expand All @@ -31,6 +32,8 @@ data PostgresConfig = PostgresConfig { _host :: String

makeLenses ''PostgresConfig

instance NFData PostgresConfig

instance ToJSON PostgresConfig where
toJSON = genericToJSON $ aesonDrop 1 snakeCase
instance FromJSON PostgresConfig where
Expand Down
3 changes: 3 additions & 0 deletions src/System/BCD/Config/Redis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module System.BCD.Config.Redis
, descr
) where

import Control.DeepSeq (NFData)
import Control.Lens (makeLenses)
import Data.Aeson (FromJSON (..), ToJSON (..),
genericParseJSON, genericToJSON)
Expand All @@ -27,6 +28,8 @@ data RedisConfig = RedisConfig { _host :: String

makeLenses ''RedisConfig

instance NFData RedisConfig

instance ToJSON RedisConfig where
toJSON = genericToJSON $ aesonDrop 1 snakeCase
instance FromJSON RedisConfig where
Expand Down
3 changes: 3 additions & 0 deletions src/System/BCD/Config/Schrodinger.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module System.BCD.Config.Schrodinger
, password
) where

import Control.DeepSeq (NFData)
import Control.Lens (makeLenses)
import Data.Aeson (FromJSON (..), ToJSON (..),
genericParseJSON, genericToJSON)
Expand All @@ -25,6 +26,8 @@ data SchrodingerConfig = SchrodingerConfig { _host :: String

makeLenses ''SchrodingerConfig

instance NFData SchrodingerConfig

instance ToJSON SchrodingerConfig where
toJSON = genericToJSON $ aesonDrop 1 snakeCase
instance FromJSON SchrodingerConfig where
Expand Down

0 comments on commit bd5aa6d

Please sign in to comment.