aboutsummaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Plugins/System
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-23 00:02:42 +0100
committertv <tv@krebsco.de>2019-01-23 00:57:36 +0100
commitd40815fd56bf1895af89b72b1171675a2e0ae5f7 (patch)
tree83b96a701f16b13915836c3a6c94463732a9f6d8 /src/Reaktor/Plugins/System
parenta00da57346c195b1b15d1c6aca2891483901aae6 (diff)
src: use more simple functionsv0.1.0
Diffstat (limited to 'src/Reaktor/Plugins/System')
-rw-r--r--src/Reaktor/Plugins/System/Internal.hs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Reaktor/Plugins/System/Internal.hs b/src/Reaktor/Plugins/System/Internal.hs
index 4a64e0b..2ed923d 100644
--- a/src/Reaktor/Plugins/System/Internal.hs
+++ b/src/Reaktor/Plugins/System/Internal.hs
@@ -1,10 +1,11 @@
{-# LANGUAGE OverloadedStrings #-}
module Reaktor.Plugins.System.Internal where
-import Data.Aeson
+import Prelude.Extended
+import Data.Aeson
import qualified Data.ByteString.Char8.Extended as BS
import qualified Data.Map as M
-import Reaktor.Internal ()
+import Reaktor ()
-- TODO this needs better names :)
@@ -24,15 +25,18 @@ instance FromJSON Activate where
parseJSON (String "query") = pure Query
parseJSON _ = undefined
-data SystemConfig = SystemConfig {
- defaultWorkDir :: Maybe FilePath,
+data Config = Config {
+ cDefaultWorkDir :: Maybe FilePath,
-- TODO IrcCommand as key for map
- hooks :: M.Map BS.ByteString [SystemParams]
+ cHooks :: M.Map BS.ByteString [SystemParams]
}
-instance FromJSON SystemConfig where
+instance Default Config where
+ def = Config Nothing mempty
+
+instance FromJSON Config where
parseJSON (Object v) =
- SystemConfig
+ Config
<$> v .:? "workdir"
<*> v .:? "hooks" .!= M.empty
parseJSON _ = pure undefined