diff options
Diffstat (limited to 'HsBot')
| -rw-r--r-- | HsBot/Base/State.hs | 14 | ||||
| -rw-r--r-- | HsBot/Callbacks/MessageCounter.hs | 4 | ||||
| -rw-r--r-- | HsBot/IRC/User.hs | 4 |
3 files changed, 17 insertions, 5 deletions
diff --git a/HsBot/Base/State.hs b/HsBot/Base/State.hs index c4c361a..2547501 100644 --- a/HsBot/Base/State.hs +++ b/HsBot/Base/State.hs @@ -1,3 +1,8 @@ +-- {-# LANGUAGE MultiParamTypeClasses #-} +-- {-# LANGUAGE FunctionalDependencies #-} +-- {-# LANGUAGE FlexibleInstances #-} +-- {-# LANGUAGE NoMonomorphismRestriction #-} + module HsBot.Base.State where import qualified Data.Map as M @@ -13,6 +18,15 @@ data State = State { users :: [User] } deriving (Show, Read) +makeDefaultState :: State +makeDefaultState = State { + isReady = False, + currentSender = "", + currentChannel = "", + line = "", + users = [] + } + stateNumUsers :: State -> Int stateNumUsers state = length $ users state diff --git a/HsBot/Callbacks/MessageCounter.hs b/HsBot/Callbacks/MessageCounter.hs index e4f8f3d..e3d8648 100644 --- a/HsBot/Callbacks/MessageCounter.hs +++ b/HsBot/Callbacks/MessageCounter.hs @@ -7,6 +7,6 @@ import HsBot.IRC.User messageCounter :: String -> SendMessage -> Env -> IO Env messageCounter str sendMessage (Env state conf) = do - let (user, users') = userGet (currentSender state) (users state) - return (Env state { users = users' } conf) + let users' = users state + return (Env state { users = users' } conf) diff --git a/HsBot/IRC/User.hs b/HsBot/IRC/User.hs index 375e55e..b45a088 100644 --- a/HsBot/IRC/User.hs +++ b/HsBot/IRC/User.hs @@ -1,6 +1,7 @@ module HsBot.IRC.User where import List +import Monad import HsBot.General.Render @@ -47,6 +48,3 @@ userGet name xs = Just user -> (user, xs) Nothing -> let user = userMakeDefault name in (user, user : xs) - - - |
