[Haskell-cafe] ANN: signed-multiset-0.1

Stefan Holdermans stefan at vectorfabrics.com
Wed Apr 18 16:34:41 CEST 2012


>> This package provides an efficient implementation of so-called
>> signed multisets, which generalise multisets by allowing for
>> negative membership.

> SignedMultiset a = Data.Map.Map a Integer


> so what do I gain by using your library?
> (what is the API difference?)

The library essentially provides some abstractions for recurring patterns when interpreting maps from elements to integers as signed multisets or free abelian groups: cardinality, union, additiveUnion, intersection, difference. Additionally it provides dedicated parsing and pretty printing utilities.

It's just like Data.Set provides abstractions from the patterns that arise when interpreting values of type Data.Map.Map a Bool (for an element type a) as sets.

> I sometimes find I want a type "Map with default"
> (the default value is stored when the Map is constructed,
> and you never put keys in there that map to this default).

You could think of SignedMultiset as an instantiation of that type (i.e., the one obtained by fixing the default to 0.



More information about the Haskell-Cafe mailing list