
7 Sep
2015
7 Sep
'15
11:47 p.m.
On 8/09/2015, at 2:08 am, DreamApart AtHaskells
class SemiGroup a where (+) :: a -> a -> a
class Group a => Ring a where -- not sure about the name ... (*) :: a -> a -> a
class Ring a => Num a where abs :: a -> a signum :: a -> a fromInteger :: Integer -> a
sum :: (Foldable t, Monoid a) => t a -> a sum = foldl' (+) zero
Traditionally, + is used only for Abelian groups, with a non-commutative binary operation being thought of as a "product", not a sum. I am not very happy at the idea of being told to use the wrong operator for a group operation. Sounds like you want NumericPrelude. (Or possibly the AXIOM computer algebra language...)