A functional semiring library