ekg/System/Remote/Gauge/Internal.hs

21 lines
414 B
Haskell
Raw Normal View History

2011-12-30 18:26:11 +00:00
{-# OPTIONS_HADDOCK not-home #-}
module System.Remote.Gauge.Internal
(
Gauge(..)
, new
, read
) where
import Data.IORef (IORef, newIORef, readIORef)
import Prelude hiding (read)
-- | A mutable, integer-valued gauge.
newtype Gauge = C { unC :: IORef Int }
-- | Create a new, zero initialized, gauge.
new :: IO Gauge
new = C `fmap` newIORef 0
read :: Gauge -> IO Int
read = readIORef . unC