From 8e0f025188e55b7463707205174c54cbbf8255d3 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 11 Sep 2017 00:35:47 +0200 Subject: Plugin.Base: Make `PluginAction` return a `Bot` monad Replace the `IO` return monad with `Bot`. `Bot` wraps the `IO` monad so it should cover us for that, while additionally providing configuration to plugin action functions. There's also some extra cruft here from when I was experimenting. The commit before this one and the next one or more were all written at once in a jumbled mess. All the extra code is collateral from that. --- src/Plugin/Base.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Plugin/Base.hs b/src/Plugin/Base.hs index d4194ee..1ef4cd2 100644 --- a/src/Plugin/Base.hs +++ b/src/Plugin/Base.hs @@ -7,13 +7,18 @@ module Plugin.Base , defaultPlugin ) where +import Control.Monad.Trans.Class (lift) import qualified Data.Text as T import Database.SQLite.Simple +-- import Config (Config) +import Bot (Bot(Bot)) import Message -type PluginAction = Message -> IO (Either T.Text T.Text) +type PluginAction = Message -> Bot (Either T.Text T.Text) + +-- newtype Foo = Config Plugin data Plugin = Plugin { matchRegex :: String -- cgit v1.2.3