Use modify instead of modify' on acid-state backend.
Shouldn't make any difference in strictness due to the way acid-state works, and should allow us to support older mtl versions.
This commit is contained in:
parent
c5ab2571a4
commit
b21904d751
@ -25,7 +25,7 @@ module Web.ServerSession.Backend.Acid.Internal
|
|||||||
|
|
||||||
import Control.Applicative ((<$>), (<*>))
|
import Control.Applicative ((<$>), (<*>))
|
||||||
import Control.Monad.Reader (ask)
|
import Control.Monad.Reader (ask)
|
||||||
import Control.Monad.State (get, modify', put)
|
import Control.Monad.State (get, modify, put)
|
||||||
import Data.Acid
|
import Data.Acid
|
||||||
import Data.Acid.Advanced
|
import Data.Acid.Advanced
|
||||||
import Data.SafeCopy
|
import Data.SafeCopy
|
||||||
@ -162,7 +162,7 @@ deleteSession
|
|||||||
=> SS.SessionId sess
|
=> SS.SessionId sess
|
||||||
-> Update (ServerSessionAcidState sess) ()
|
-> Update (ServerSessionAcidState sess) ()
|
||||||
deleteSession sid =
|
deleteSession sid =
|
||||||
modify' $ \state ->
|
modify $ \state ->
|
||||||
let oldSession = HM.lookup sid (sessionIdToSession state)
|
let oldSession = HM.lookup sid (sessionIdToSession state)
|
||||||
newSessionIdToSession = HM.delete sid (sessionIdToSession state)
|
newSessionIdToSession = HM.delete sid (sessionIdToSession state)
|
||||||
newAuthIdToSessionId = removeSessionFromAuthId sid mauthId $ authIdToSessionId state
|
newAuthIdToSessionId = removeSessionFromAuthId sid mauthId $ authIdToSessionId state
|
||||||
@ -176,7 +176,7 @@ deleteAllSessionsOfAuthId
|
|||||||
=> SS.AuthId
|
=> SS.AuthId
|
||||||
-> Update (ServerSessionAcidState sess) ()
|
-> Update (ServerSessionAcidState sess) ()
|
||||||
deleteAllSessionsOfAuthId authId =
|
deleteAllSessionsOfAuthId authId =
|
||||||
modify' $ \state ->
|
modify $ \state ->
|
||||||
let sessionIds = HM.lookup authId (authIdToSessionId state)
|
let sessionIds = HM.lookup authId (authIdToSessionId state)
|
||||||
newAuthIdToSessionId = HM.delete authId (authIdToSessionId state)
|
newAuthIdToSessionId = HM.delete authId (authIdToSessionId state)
|
||||||
newSessionIdToSession = maybe id removeSession sessionIds $ sessionIdToSession state
|
newSessionIdToSession = maybe id removeSession sessionIds $ sessionIdToSession state
|
||||||
@ -196,7 +196,7 @@ insertSession session = do
|
|||||||
Just old -> throwAS $ SS.SessionAlreadyExists old session
|
Just old -> throwAS $ SS.SessionAlreadyExists old session
|
||||||
insertAuth = insertSessionForAuthId sid (SS.sessionAuthId session)
|
insertAuth = insertSessionForAuthId sid (SS.sessionAuthId session)
|
||||||
sid = SS.sessionKey session
|
sid = SS.sessionKey session
|
||||||
modify' $ \state ->
|
modify $ \state ->
|
||||||
ServerSessionAcidState
|
ServerSessionAcidState
|
||||||
(insertSess $ sessionIdToSession state)
|
(insertSess $ sessionIdToSession state)
|
||||||
(insertAuth $ authIdToSessionId state)
|
(insertAuth $ authIdToSessionId state)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user