On 2 Apr 2008, at 16:20, Loup Vaillant wrote:
class AdditiveSemiMonoid a where
  (+) :: a -> a -> a

Err, why *semi* monoid? Plain "monoid" would not be accurate?

A monoid has a unit:
  class (AdditiveSemiMonoid a) => AdditiveMonoid a where
    o :: a

The semimonoid is also called semigroup, I think.

<rant>
While we're at it, what about adding even more classes, like "group"
or "ring"? Algebra in a whole class hierachy. :-)

Only ambition required :-).

It is probably easier to make a copy of Prelude.hs to say NewPrelude.hs, and modify it directly, by inserting intermediate classes.

  Hans


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to