diff options
author | tv <tv@krebsco.de> | 2019-01-23 00:02:42 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-01-23 00:57:36 +0100 |
commit | d40815fd56bf1895af89b72b1171675a2e0ae5f7 (patch) | |
tree | 83b96a701f16b13915836c3a6c94463732a9f6d8 /src/Reaktor/Plugins/System | |
parent | a00da57346c195b1b15d1c6aca2891483901aae6 (diff) |
src: use more simple functions
Diffstat (limited to 'src/Reaktor/Plugins/System')
-rw-r--r-- | src/Reaktor/Plugins/System/Internal.hs | 18 |
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 |