From 502eae3f286cca6a1843ed795ec20fbc3abccc5d Mon Sep 17 00:00:00 2001 From: pb Date: Sat, 15 May 2010 16:49:57 +0000 Subject: added the stateUpdateUser function to State.hs git-svn-id: https://ssl.buetow.org/repos/hsbot/trunk@60 9f8f72e9-4bf4-416e-b76e-7d4203597157 --- HsBot/Base/State.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'HsBot/Base') diff --git a/HsBot/Base/State.hs b/HsBot/Base/State.hs index 10395bb..9c38e42 100644 --- a/HsBot/Base/State.hs +++ b/HsBot/Base/State.hs @@ -33,6 +33,11 @@ stateNumUsers state = length $ users state stateSortedUsers :: State -> [User] stateSortedUsers state = sort $ users state +stateUpdateUser :: State -> String -> (User -> User) -> State +stateUpdateUser state name update = + let updatedUsers = usersUpdate name (users state) update + in state { users = updatedUsers } + stateLoad :: String -> IO State stateLoad databaseFile = do file <- readFile databaseFile -- cgit v1.2.3