mapGauge :: (a->b) -> (b->a) -> Gauge a -> Gauge b mapIOGauge :: (a-> IO b) -> (b-> IO a) -> Gauge a -> Gauge bmapGauge f tr creates a new Gauge that transforms values reported on an existing Gauge. For setGauge on the Gauge handle to have effect on the Gauge being `mapped' from, a function for transforming values from the `new' domain back to the `old' is also needed.
filterGauge :: ((a,Bool) -> Bool) -> Gauge a -> Gauge a filterIOGauge :: ((a,Bool) -> IO Bool) -> Gauge a -> Gauge afilterGauge returns a new Gauge handle that will only report values output on gauge that satisfy pred.
nm = getGaugeName (setGaugeName nm tr)
combineGauges merges a list of gauges into one, and sometimes, we want to be able to change the disabled/enabled state of one of these combined gauges via this super-gauge, i.e., if we represent a multiple choice group using a Gauge and combineGauges, it would be really useful if we could selectively changed the enabled/disabled state of the items via the choice group gauge directly.
To achieve exactly this, a Gauge can be given a name using the setGaugeName above, which is used to `guide' the enable/disable operations (see below.) To specify a path through a hierarchy, a list of gauge names, called GaugeNames is used. To illustrate, imagine we have built the following hierarchy using combineGauges and setGaugeName:
t1-+---t10
|
+---t11
|
+---t12
|
+---t13
|
+---t14
The GaugeName ["t11"] refers to the second gauge of the combined gauges, so doing activateGauge tr ["t11"] False will disable this item. Similarly, activateGauge tr ["t1"] False matches Gauge with name t1 and everything underneath it.
activateGauge tr [] Falsedisables the whole hierarchy.