[Haskell-cafe] vector-space and standard API for vectors

Sebastian Fischer fischer at nii.ac.jp
Sat Oct 23 22:43:52 EDT 2010

On Oct 24, 2010, at 8:52 AM, wren ng thornton wrote:

> But then, how should we decide whether the additive or  
> multiplicative structure is more "neutral"?

On Oct 24, 2010, at 7:08 AM, Jacques Carette wrote:

> People usually use additive notation for commutative monoids, and  
> multiplicative notation for generic monoids.  It's a convention,  
> nothing else.

I recently used

     class Monoid m where
       one :: m
       (*) :: m -> m -> m

     class CommutativeMonoid m where
       zero :: m
       (+)  :: m -> m -> m

    class (Monoid s, CommutativeMonoid s) => Semiring s

(The `Semiring` class only serves as a contract for additional laws.)

Considering the convention Jaques mentions and my wish for splitting  
the two monoids underlying a semiring into separate classes, it seemed  
natural to use multiplicative notation for the "neutral" case.


More information about the Haskell-Cafe mailing list