)
where
import Blaze.ByteString.Builder (Builder)
-import Control.Applicative
import Control.Concurrent.STM
import Data.Ascii (Ascii)
import qualified Data.ByteString as BS
, itrWillClose ∷ !(TVar Bool)
, itrBodyToSend ∷ !(TMVar Builder)
- , itrBodyIsNull ∷ !(TVar Bool)
+ , itrSentNoBody ∷ !(TVar Bool)
, itrState ∷ !(TVar InteractionState)
willClose ← newTVarIO False
bodyToSend ← newEmptyTMVarIO
- bodyIsNull ← newTVarIO True -- 一度でも bodyToSend が空でなくなったら False
+ sentNoBody ← newTVarIO True -- 一度でも bodyToSend が空でなくなったら False
state ← newTVarIO ExaminingRequest
, itrWillClose = willClose
, itrBodyToSend = bodyToSend
- , itrBodyIsNull = bodyIsNull
+ , itrSentNoBody = sentNoBody
, itrState = state
writeItr accessor a itr
= writeTVar (accessor itr) a
-readItr ∷ (Interaction → TVar a) → (a → b) → Interaction → STM b
+readItr ∷ (Interaction → TVar a) → Interaction → STM a
{-# INLINE readItr #-}
-readItr accessor reader itr
- = reader <$> readTVar (accessor itr)
+readItr accessor itr
+ = readTVar (accessor itr)
updateItr ∷ (Interaction → TVar a) → (a → a) → Interaction → STM ()
{-# INLINE updateItr #-}
updateItr accessor updator itr
- = do old ← readItr accessor id itr
+ = do old ← readItr accessor itr
writeItr accessor (updator old) itr