Strafunski-StrategyLib-5.0.0.9: Library for strategic programming

MaintainerRalf Laemmel, Joost Visser
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Data.Generics.Strafunski.StrategyLib.MetricsTheme

Contents

Description

This module is part of StrategyLib, a library of functional strategy combinators, including combinators for generic traversal. This module defines combinators to define metrics extractors.

Synopsis

An abstract datatype for metrics

type Metrics = MetricName -> Integer Source #

The type of metrics

type MetricName = String Source #

The type of metric names

initMetrics :: Integer -> Metrics Source #

Create Metrics with given initial value for all metrics.

initMetrics0 :: Metrics Source #

Create Metrics with 0 as initial value for all metrics.

incMetrics :: MetricName -> Integer -> Metrics -> Metrics Source #

Create Metrics with initTypeMetrics :: MetricName -> a -> Metrics initTypeMetrics key _ = incMetrics1 key initMetrics0

Increment metric with the given name with the given value.

incMetrics1 :: MetricName -> Metrics -> Metrics Source #

Increment metric with the given name by 1.

putMetricLn :: MetricName -> Metrics -> IO () Source #

Print value of metric with the given name.

Metrics as monoids

Strategy combinators for metrics

typeMetric Source #

Arguments

:: (MonadPlus m, Term a) 
=> TU Metrics m

Metric collecting strategy

-> (MetricName, a -> ())

Name of the metric and type guard

-> TU Metrics m

Strategy that additionally collects type-based metrics

Additionally collect type-based metrics.

Generic metric algorithms

depthWith Source #

Arguments

:: MonadPlus m 
=> TU () m

Recognize relevant contructs

-> TU Int m

Count nesting depth of relevant constructs.

Generic algorithm for computing nesting depth

Orphan instances