2017-11-15 18:00:34 +05:30
|
|
|
module System.Metrics.Gauge (Gauge, new, read) where
|
|
|
|
|
|
|
|
import Control.Monad.Aff (Aff)
|
|
|
|
|
2017-11-20 17:06:31 +05:30
|
|
|
-- | An integer valued metric.
|
2017-11-15 18:00:34 +05:30
|
|
|
newtype Gauge = Gauge (forall eff. Aff eff Int)
|
|
|
|
|
2017-11-20 17:06:31 +05:30
|
|
|
-- | Creates a new gauge given the underlying measurement function.
|
2017-11-15 18:00:34 +05:30
|
|
|
new :: (forall eff. Aff eff Int) -> Gauge
|
|
|
|
new = Gauge
|
|
|
|
|
2017-11-20 17:06:31 +05:30
|
|
|
-- | Returns the current value of the gauge.
|
2017-11-15 18:00:34 +05:30
|
|
|
read :: forall eff. Gauge -> Aff eff Int
|
|
|
|
read (Gauge f) = f
|