Some API refactoring.
I can't say how I hate the Types.hs thing in Haskell!
This commit is contained in:
parent
d4be110200
commit
864a364da9
7 changed files with 47 additions and 51 deletions
|
@ -1,9 +1,21 @@
|
|||
module Hsbot.Message
|
||||
( Message (..)
|
||||
( readMsg
|
||||
, writeMsg
|
||||
) where
|
||||
|
||||
import qualified Network.IRC as IRC
|
||||
import Control.Concurrent
|
||||
import Control.Monad.State
|
||||
|
||||
data Message = IncomingMsg IRC.Message
|
||||
| OutgoingMsg IRC.Message
|
||||
import Hsbot.Types
|
||||
|
||||
-- Plugin Utils
|
||||
readMsg :: Plugin IO (Message)
|
||||
readMsg = do
|
||||
chan <- gets pluginChan
|
||||
liftIO $ readChan chan >>= return
|
||||
|
||||
writeMsg :: Message -> Plugin IO ()
|
||||
writeMsg msg = do
|
||||
chan <- gets pluginMaster
|
||||
liftIO $ writeChan chan msg
|
||||
|
||||
|
|
Reference in a new issue