From eb732a97b82f9d03f68247d79301ee26b84b650b Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 4 Nov 2017 03:00:38 +0100 Subject: Bot(privmsgFromPlugin): Try to use the `Bot` monad instead of `IO` Convert this function and `Plugins(performPlugin)` to use a `Bot`-wrapped plugin. Still having a lot of trouble with this, unable to get past monad-related compilation errors. The plan is to leave this as-is for now and attack the problem from a different place, looking at the `main` function next, applying our plugins with `runBot`, and then passing those monad-wrapped plugins to `connectIRC`. Once that's taken care of, we'll see what we need to modify in this middle strata of the stack. --- src/Plugin.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Plugin.hs') diff --git a/src/Plugin.hs b/src/Plugin.hs index 04a8054..d4aa6f9 100644 --- a/src/Plugin.hs +++ b/src/Plugin.hs @@ -67,8 +67,10 @@ matchPlugins message plugins = -- [return p | p <- plugins', M.textStr message =~ matchRegex p] -- | Run the action belonging to the plugin, stored in its `perform` field. -performPlugin :: Plugin -> PluginAction -performPlugin p message = perform p $ message +performPlugin :: Bot Plugin -> PluginAction +performPlugin p message = do + plugin <- p + perform plugin $ message plugins :: [Bot Plugin] plugins = PL.plugins ++ [help] -- cgit v1.2.3