module Network.Salvia.Handler.Counter (hCounter) where import Control.Concurrent.STM import Control.Monad.State import Network.Salvia.Httpd {- | This handler simply increases the request counter variable. -} hCounter :: TVar Int -> Handler () hCounter c = lift $ atomically $ readTVar c >>= writeTVar c . (+1)