Archived
1
0
Fork 0

Made the Plugin monad a Reader instead of a State since it can't change.

This commit is contained in:
Julien Dessaux 2011-05-06 19:15:40 +02:00
parent 4ec66d2ad7
commit a8c0c85787
7 changed files with 15 additions and 22 deletions

View file

@ -5,17 +5,17 @@ module Hsbot.Message
) where
import Control.Concurrent
import Control.Monad.State
import Control.Monad.Reader
import qualified Network.IRC as IRC
import Hsbot.Types
-- Plugin Utils
readMsg :: Plugin (Env IO) Message
readMsg = gets pluginChan >>= liftIO . readChan
readMsg = asks pluginChan >>= liftIO . readChan
writeMsg :: Message -> Plugin (Env IO) ()
writeMsg msg = gets pluginMaster >>= liftIO . flip writeChan msg
writeMsg msg = asks pluginMaster >>= liftIO . flip writeChan msg
answerMsg :: IRC.Message -> String -> Plugin (Env IO) ()
answerMsg request msg =