From d40815fd56bf1895af89b72b1171675a2e0ae5f7 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 23 Jan 2019 00:02:42 +0100 Subject: src: use more simple functions --- src/Reaktor/Plugins/System/Internal.hs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/Reaktor/Plugins/System') 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 -- cgit v1.2.3