
Hi, Reading about Monoids it seems they derive a lot on the algebraic structures of 'Groups' ? Is it then correct to assume that Monoids can be used to represent 'Groups' ? If not are there any standard haskell libraries which represent algebraic structures such as 'Groups' , 'Fields' etc. Thanks, Shishir Srivastava

On Wed, Mar 25, 2015 at 10:02 AM, Shishir Srivastava < shishir.srivastava@gmail.com> wrote:
Reading about Monoids it seems they derive a lot on the algebraic structures of 'Groups' ?
A monoid is a semigroup with an identity element, and as such inherits much of its behavior from semigroups. For historical reasons, a Haskell Monoid is not based on a notional Haskell Semigroup. There are packages that add semigroups and other algebraic structures, and even alternative Preludes that provide a reasonably complete set of algebraic structures. Every so often you'll see bikeshedding in the Haskell community over whether the default Prelude should provide some or all of these. :) -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

Hi, While they have similarities, they are not the same. Semigroup (S,*) is a set S with associative binary operation *. Monoid is a semigroup that has identity element i such that i * a = a and a * i = a. And group is a monoid in which every element of set has it’s own inverse: a * b = i and b * a = i where b is an inverse of a. Let’s look at the definition of Monoid in haskell. class Monoid a where mempty :: a -- ^ Identity of 'mappend' mappend :: a -> a -> a -- ^ An associative operation mconcat :: [a] -> a -- ^ Fold a list using the monoid. -- For most types, the default definition for 'mconcat' will be -- used, but the function is included in the class definition so -- that an optimized version can be provided for specific types. mconcat = foldr mappend mempty So we have a set of a, associative binary operation mappend and identity element mempty. The only difference between Monoid a in haskell and monoid in algebra is that Monoid in haskell has mconcat function in it’s definition. But you can ignore it. I hope it helps. Cheers, d12frosted On March 25, 2015 at 16:03:14, Shishir Srivastava (shishir.srivastava@gmail.com) wrote: Hi, Reading about Monoids it seems they derive a lot on the algebraic structures of 'Groups' ? Is it then correct to assume that Monoids can be used to represent 'Groups' ? If not are there any standard haskell libraries which represent algebraic structures such as 'Groups' , 'Fields' etc. Thanks, Shishir Srivastava _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
participants (3)
-
Boris
-
Brandon Allbery
-
Shishir Srivastava