aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2016-05-27 19:38:49 +0200
committerFélix Sipma <felix.sipma@no-log.org>2016-05-27 19:38:49 +0200
commit1d7b62716681ba3b8a37159e046b33d1c349789a (patch)
tree41c80715d80062586a1592b887b3aec25d1c2e7e
parentc7e5055773d311bb1a31ffe0102bc2024e84d34e (diff)
revert bang pattern usage, use ! in record fields
-rw-r--r--src/Config.hs15
-rw-r--r--src/Config/CmdConfig.hs9
-rw-r--r--src/Config/FileConfig.hs11
-rw-r--r--src/Config/InternalConfig.hs15
-rw-r--r--src/Filter.hs5
-rw-r--r--src/Types.hs39
6 files changed, 44 insertions, 50 deletions
diff --git a/src/Config.hs b/src/Config.hs
index f6ad66b..e06739c 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -1,6 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE BangPatterns #-}
module Config
( Config
, getConfigConfigFile
@@ -32,13 +31,13 @@ import Filter
data Config = Config
- { configFile :: Path Abs File
- , configDatabase :: Path Abs File
- , configFeedInfos :: [FeedInfo]
- , configAddressFrom :: ConfigAddress
- , configAddressTo :: ConfigAddress
- , configTopicLength :: Int
- , configLogLevel :: LogLevel
+ { configFile :: !(Path Abs File)
+ , configDatabase :: !(Path Abs File)
+ , configFeedInfos :: ![FeedInfo]
+ , configAddressFrom :: !ConfigAddress
+ , configAddressTo :: !ConfigAddress
+ , configTopicLength :: !Int
+ , configLogLevel :: !LogLevel
}
getConfigConfigFile :: Config -> Path Abs File
diff --git a/src/Config/CmdConfig.hs b/src/Config/CmdConfig.hs
index aeefe87..f58412a 100644
--- a/src/Config/CmdConfig.hs
+++ b/src/Config/CmdConfig.hs
@@ -1,5 +1,4 @@
{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE BangPatterns #-}
module Config.CmdConfig
( parseCmdLine
, cmdConfigToInternalConfig
@@ -13,10 +12,10 @@ import Filter
data CmdConfig = CmdConfig
- { _cmdConfigFile :: Maybe FilePath
- , _cmdConfigDatabase :: Maybe FilePath
- , _cmdConfigDebug :: Bool
- , _cmdConfigFeedUrls :: Maybe [Url]
+ { _cmdConfigFile :: !(Maybe FilePath)
+ , _cmdConfigDatabase :: !(Maybe FilePath)
+ , _cmdConfigDebug :: !Bool
+ , _cmdConfigFeedUrls :: !(Maybe [Url])
}
parser :: Parser CmdConfig
diff --git a/src/Config/FileConfig.hs b/src/Config/FileConfig.hs
index 3bc8101..e2e242f 100644
--- a/src/Config/FileConfig.hs
+++ b/src/Config/FileConfig.hs
@@ -1,5 +1,4 @@
{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE BangPatterns #-}
module Config.FileConfig
( parseConfigFile
, writeInternalConfig
@@ -17,11 +16,11 @@ import Filter
data FileConfig = FileConfig
- { _fileConfigDatabase :: Maybe FilePath
- , _fileConfigFeedInfos :: Maybe [FeedInfo]
- , _fileConfigAddressFrom :: Maybe ConfigAddress
- , _fileConfigAddressTo :: Maybe ConfigAddress
- , _fileConfigTopicLength :: Maybe Int
+ { _fileConfigDatabase :: !(Maybe FilePath)
+ , _fileConfigFeedInfos :: !(Maybe [FeedInfo])
+ , _fileConfigAddressFrom :: !(Maybe ConfigAddress)
+ , _fileConfigAddressTo :: !(Maybe ConfigAddress)
+ , _fileConfigTopicLength :: !(Maybe Int)
}
instance FromJSON FileConfig where
diff --git a/src/Config/InternalConfig.hs b/src/Config/InternalConfig.hs
index 741e4d8..601997b 100644
--- a/src/Config/InternalConfig.hs
+++ b/src/Config/InternalConfig.hs
@@ -1,5 +1,4 @@
{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE BangPatterns #-}
module Config.InternalConfig
( InternalConfig
, mkInternalConfig
@@ -26,13 +25,13 @@ import Filter
data InternalConfig = InternalConfig
- { internalConfigFile :: Maybe (Path Abs File)
- , internalConfigDatabase :: Maybe (Path Abs File)
- , internalConfigFeedInfos :: Maybe [FeedInfo]
- , internalConfigAddressFrom :: Maybe ConfigAddress
- , internalConfigAddressTo :: Maybe ConfigAddress
- , internalConfigTopicLength :: Maybe Int
- , internalConfigLogLevel :: Maybe LogLevel
+ { internalConfigFile :: !(Maybe (Path Abs File))
+ , internalConfigDatabase :: !(Maybe (Path Abs File))
+ , internalConfigFeedInfos :: !(Maybe [FeedInfo])
+ , internalConfigAddressFrom :: !(Maybe ConfigAddress)
+ , internalConfigAddressTo :: !(Maybe ConfigAddress)
+ , internalConfigTopicLength :: !(Maybe Int)
+ , internalConfigLogLevel :: !(Maybe LogLevel)
}
instance Monoid InternalConfig where
diff --git a/src/Filter.hs b/src/Filter.hs
index 2f8df68..f854a45 100644
--- a/src/Filter.hs
+++ b/src/Filter.hs
@@ -1,7 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE BangPatterns #-}
module Filter
( FeedFilter (..)
, FeedInfo (..)
@@ -55,8 +54,8 @@ instance ToJSON FeedFilter where
data FeedInfo
= FeedInfo
- { feedInfoUrl :: Url
- , feedInfoFilter :: [FeedFilter]
+ { feedInfoUrl :: !Url
+ , feedInfoFilter :: ![FeedFilter]
}
mkFeedInfo :: Url -> FeedInfo
diff --git a/src/Types.hs b/src/Types.hs
index d411c4d..07b3791 100644
--- a/src/Types.hs
+++ b/src/Types.hs
@@ -1,6 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
-{-# LANGUAGE BangPatterns #-}
module Types
( Feed (..)
, Entry (..)
@@ -35,38 +34,38 @@ import qualified Data.ByteString as S
data Feed
= Feed
- { feedId :: T.Text
- , feedTitle :: T.Text
- , feedUpdated :: UTCTime
- , feedAuthors :: [Person]
- , feedLinks :: [Link]
- , feedEntries :: [Entry]
+ { feedId :: !T.Text
+ , feedTitle :: !T.Text
+ , feedUpdated :: !UTCTime
+ , feedAuthors :: ![Person]
+ , feedLinks :: ![Link]
+ , feedEntries :: ![Entry]
}
deriving (Show)
data Entry
= Entry
- { entryId :: T.Text
- , entryTitle :: T.Text
- , entryUpdated :: UTCTime
- , entryAuthors :: [Person]
- , entryContent :: Maybe Content
- , entryLinks :: [Link]
+ { entryId :: !T.Text
+ , entryTitle :: !T.Text
+ , entryUpdated :: !UTCTime
+ , entryAuthors :: ![Person]
+ , entryContent :: !(Maybe Content)
+ , entryLinks :: ![Link]
}
deriving (Show)
data Link
= Link
- { linkHref :: Url
- , linkRel :: Maybe T.Text
+ { linkHref :: !Url
+ , linkRel :: !(Maybe T.Text)
}
deriving (Show)
data Person
= Person
- { personName :: T.Text
- , personURI :: Maybe Url
- , personEmail :: Maybe Email
+ { personName :: !T.Text
+ , personURI :: !(Maybe Url)
+ , personEmail :: !(Maybe Email)
}
deriving (Show)
@@ -85,8 +84,8 @@ type Email = T.Text
type Database = Path Abs File
data ConfigAddress = ConfigAddress
- { _name :: Maybe T.Text
- , _email :: Email
+ { _name :: !(Maybe T.Text)
+ , _email :: !Email
}
deriving (Show)