[Haskell-cafe] Function Precedence

Hans Aberg haberg at math.su.se
Wed Apr 2 10:27:12 EDT 2008


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




More information about the Haskell-Cafe mailing list