aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-09-11 00:35:47 +0200
committerTeddy Wing2017-09-11 00:35:47 +0200
commit8e0f025188e55b7463707205174c54cbbf8255d3 (patch)
treef908353166188b72ebb2696088be295efd65beb1
parent356926db7763b21b9c4e1a9fd36e37caa04c25ca (diff)
downloadsorbot-8e0f025188e55b7463707205174c54cbbf8255d3.tar.bz2
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.
-rw-r--r--src/Plugin/Base.hs7
1 files changed, 6 insertions, 1 deletions
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