This library packages the functional peal paper 'Sparse Bitmaps for Pattern Match Coverage' submitted to ICFP 2009 by Ki Yung Ahn and Tim Sheard. You can look up the tutorial-like paper and the talk slides, which are availabel at:

http://kyagrd.dyndns.org/wiki/SparseBitmapsForPatternMatchCoverage

Abstract:

Pattern matching coverage over Algebraic Data Types(ADTs) has most often been studied in the context of pattern compilation algorithms. However, it is worth considering the pattern matching coverage problem in isolation, since general solutions will be independent of the specifics of any implementation or language.

We define an intuitive and mathematically well-established bit masking semantics for pattern match coverage. We design and implement a sparse bitmap data structure, which realizes this semantics in a compact and flexible manner. This bitmap data structure supports computing coverage solutions of large programs incrementally from coverage solutions of sub-programs. It can also be used as a common data representation for pattern coverage shared between different tools (e.g., compilers, linting tools, software analysis tools) that need pattern match coverage information.

- class Expand t where
- data BIT t
- typeof :: BIT t -> t
- showB :: BIT t -> String
- showB' :: BIT t -> String
- printB :: BIT t -> IO ()
- (.&) :: BIT t -> BIT t -> BIT t
- (.&.) :: [BIT t] -> [BIT t] -> [BIT t]
- (.|) :: BIT t -> BIT t -> BIT t
- (.|.) :: [BIT t] -> [BIT t] -> [BIT t]
- neg :: BIT t -> BIT t
- reduce :: BIT t -> BIT t
- (.**) :: Expand t => BIT t -> BIT t -> BIT t
- (=:=) :: Eq t => BIT t -> BIT t -> Bool

# Documentation

type product

Type product of two types is usually a product type (or pair type).
Conceptually, for example, `Int *. Bool = (Int,Bool)`

.
Note, (`*.`

) have at least one identity `unit`

,
and type product against such identities may not result in a prodcut type.

identity on (`*.`

)

unit *. a = a = a *. unit

Note, there can be other identities depending on how you define `expand`

.
Any type `a`

that satisfy `null(expand a)`

is an identity on (`*.`

).
The `unit`

is the most simple and basic identity among them,
which serves as a degenerate type for nullary data data constants
(e.g., `True`

, `False`

).

type expansion rule

The definition of expand summarizes the structure of algebraic data type. Conceptually, for example,

expand unit = [] -- the-non expandable degenerate type expand Bool = [unit,unit] -- True, False expand (Maybe a) = [unit, a] -- Nothing, Just a

extract the type information of a given bit

For example,

typeof (O Bool) = Bool typeof (I Bool) = Int typeof (Bs [O unit,I unit] Bool) = Bool

showB :: BIT t -> StringSource

turn bits into strings without the type information

For example,

showB (Bs [O unit,I unit] Bool) = "[01]"

showB' :: BIT t -> StringSource

same as `showB`

but takes off the outermost square bracket

For example,

showB' (Bs [O unit,I unit] Bool) = "01"