2009/11/15 Eugene Kirpichov ekirpic...@gmail.com
Hey, I've found terrific slides about monoids!
http://comonad.com/reader/wp-content/uploads/2009/08/IntroductionToMonoids.pdf
Edward Kmett, you rock!
Glad you enjoyed the slides. =)
There's more
In my own opinion, the reason why we use the concept of a monoid or a
monad is in order to build libraries around the concepts.
For example, the do construct could have been designed just for
doing IO, but because it works for *any* monad you can also use the
same syntax sugar to
Excerpts from Daniel Schüssler's message of Sun Nov 15 07:51:35 +0100 2009:
Hi,
Hi,
-- Invariant 1: There are never two adjacent Lefts or two adjacent Rights
[...]
normalize (Left a0 : Left a1 : as) = Left (mappend a0 a1) : normalize as
normalize (Right a0 : Right a1 : as) = Right (mappend a0
On Sunday 15 November 2009 13:05:08 Nicolas Pouillard wrote:
Excerpts from Daniel Schüssler's message of Sun Nov 15 07:51:35 +0100 2009:
Hi,
Hi,
Hi,
-- Invariant 1: There are never two adjacent Lefts or two adjacent Rights
[...]
normalize (Left a0 : Left a1 : as) = Left (mappend
Hey, I've found terrific slides about monoids!
http://comonad.com/reader/wp-content/uploads/2009/08/IntroductionToMonoids.pdf
Edward Kmett, you rock!
There's more http://comonad.com/reader/2009/iteratees-parsec-and-monoid/
- but the second part was too hard for me to read it fully without
special
2009/11/14 Daniel Schüssler anotheraddr...@gmx.de:
- Product (a,b) and co-product (Either) of monoids
the coproduct of monoids is actually a bit tricky.
Funny, I was just thinking about that.
I was pondering the article at LTU on Lawvere theories:
http://lambda-the-ultimate.org/node/3235
Hi,
- Product (a,b) and co-product (Either) of monoids
the coproduct of monoids is actually a bit tricky. It could be implemented
like this:
-- |
-- Invariant 1: There are never two adjacent Lefts or two adjacent Rights
-- Invariant 2: No elements (Left mempty) or (Right mempty) allowed
Hi,
I have looked the concept of monoid and something related, but
still, I do not know why we use it?
--
竹密岂妨流水过
山高哪阻野云飞
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Disclaimer: I don't really know all about category theory, so some
definitions might not be absolutely correct.
Monoid is the category of all types that have a empty value and an append
operation.
The best example is a list.
instance Monoid [a] where
mempty = []
mappend = (++)
2009/11/13 Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com:
Monoid is the category of all types that have a empty value and an append
operation.
Or more generally a neutral element and an associative operation:
The multiplication monoid (1,*)
9*1*1*1 = 9
1 is neutral but
Stephen Tetley wrote:
2009/11/13 Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com:
Monoid is the category of all types that have a empty value and an append
operation.
Or more generally a neutral element and an associative operation:
The multiplication monoid (1,*)
There is an astonishing number of things in programming that are monoids:
- Numbers, addition, 0
- Numbers, multiplication, 1
- Lists, concatenation, [] (including strings)
- Sorted lists, merge with respect to a linear order, []
- Sets, union, {}
- Maps, left-biased or right-biased union,
On Fri, Nov 13, 2009 at 4:52 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:
Stephen Tetley wrote:
2009/11/13 Rafael Gustavo da Cunha Pereira Pinto
rafaelgcpp.li...@gmail.com:
Monoid is the category of all types that have a empty value and an append
operation.
Or more generally a
Hum... simple like that. So you meant the Monoid just
abstracts/represents the ability to build a stack, right?
2009/11/14 Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp.li...@gmail.com:
Disclaimer: I don't really know all about category theory, so some
definitions might not be absolutely
Magnus Therning wrote:
On Fri, Nov 13, 2009 at 4:52 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:
A class that represents any possible thing that can technically
be considered a monoid seems so absurdly general as to be almost useless.
If you don't know what an operator *does*, being
That is OK. Since understand the basic concept of monoid (I mean the
thing in actual math), the idea here is totally not hard for me. But
the sample here does not show why (or how) we use it in programming,
right?
On Sat, Nov 14, 2009 at 12:48 AM, Stephen Tetley
stephen.tet...@gmail.com wrote:
2009/11/13 Magnus Therning mag...@therning.org:
On Fri, Nov 13, 2009 at 4:52 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:
This is the thing. If we had a class specifically for containers, that could
be useful. If we had a class specifically for algebras, that could be
useful. But a
*...in my humble opinion. (Which, obviously, nobody else will agree with.)
*
I somewhat agree with your opinion!!
What I miss the most is practical examples:
1) A function that uses a Monoid as a container
2) A function that uses Monoid as algebra
and so on, for most of categories.
I had a
I see. Then what is about Dual and Endo? Especially Endo, I completely
confused
2009/11/14 Eugene Kirpichov ekirpic...@gmail.com:
There is an astonishing number of things in programming that are monoids:
- Numbers, addition, 0
- Numbers, multiplication, 1
- Lists, concatenation, []
On Fri, Nov 13, 2009 at 8:52 AM, Andrew Coppin
andrewcop...@btinternet.comwrote:
Stephen Tetley wrote:
2009/11/13 Rafael Gustavo da Cunha Pereira Pinto
rafaelgcpp.li...@gmail.com:
Monoid is the category of all types that have a empty value and an append
operation.
Or more generally
A monoid is just an associative binary operation with a unit. They appear
all over the place.
Why do we bother to talk about them in programming?
Well, it turns out that there are a lot of ways you can take advantage of
that fairly minimal amount of structure.
For one, you could take any
For every monoid (M, *, u), the dual to it is the monoid (Dual M, \x y
- y * x, u)
For every type A, there exists the A-endomorphism monoid (A-A, (.),
id). Endo A is just a newtype for A - A.
More simply, dualization is flipping the binary operation, and the
endo monoid is the monoid of functions
Andrew Coppin wrote:
This is the thing. If we had a class specifically for containers, that
could be useful. If we had a class specifically for algebras, that could
be useful. But a class that represents any possible thing that can
technically be considered a monoid seems so absurdly general
Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote:
Message: 26
Date: Sat, 14 Nov 2009 01:11:27 +0800
From: Magicloud Magiclouds magicloud.magiclo...@gmail.com
Subject: Re: [Haskell-cafe] Could someone teach me why we use
Data.Monoid?
To: Stephen Tetley stephen.tet
Thank you guys. I think I learned a lot. Pretty confusing and interesting.
2009/11/14 Eugene Kirpichov ekirpic...@gmail.com:
For every monoid (M, *, u), the dual to it is the monoid (Dual M, \x y
- y * x, u)
For every type A, there exists the A-endomorphism monoid (A-A, (.),
id). Endo A is
Magicloud Magiclouds magicloud.magiclo...@gmail.com writes:
I see. Then what is about Dual and Endo? Especially Endo, I completely
confused
It should help to look at the instances:
-- | The dual of a monoid, obtained by swapping the arguments of 'mappend'.
newtype Dual a = Dual {
Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote:
That is OK. Since understand the basic concept of monoid (I mean the
thing in actual math), the idea here is totally not hard for me. But
the sample here does not show why (or how) we use it in programming,
right?
Hi Magicloud
On Fri, Nov 13, 2009 at 08:37:57PM +0300, Eugene Kirpichov wrote:
For every monoid (M, *, u), the dual to it is the monoid (Dual M, \x y
- y * x, u)
The entirely standard name for this is the opposite monoid. The only
places I have seen the name dual monoid used to mean opposite monoid
are in
On Fri, Nov 13, 2009 at 1:10 PM, Stephen Tetley stephen.tet...@gmail.comwrote:
Magicloud Magiclouds magicloud.magiclo...@gmail.com wrote:
That is OK. Since understand the basic concept of monoid (I mean the
thing in actual math), the idea here is totally not hard for me. But
the sample
Hi Edward
Many thanks.
I've mostly used groupoid for 'string concatenation' on types that I
don't consider to have useful empty (e.g PostScript paths, bars of
music...), as string concatenation is associative it would have been
better if I'd used semigroup in the first place (bounding box union
On 13/11/09 18:43, Edward Kmett wrote:
[..]
Watch out, in more common parlance, having just an binary operation is a
magma, while having a category with full inverses yields a groupoid. I
haven't seen many people use the older groupoid term for magmas, if only
because they started to have
On Fri, 2009-11-13 at 15:16 -0200, Rafael Gustavo da Cunha Pereira Pinto
wrote:
...in my humble opinion. (Which, obviously, nobody else will agree
with.)
I somewhat agree with your opinion!!
What I miss the most is practical examples:
1) A function that uses a Monoid as a container
Magicloud Magiclouds wrote:
Hum... simple like that. So you meant the Monoid just
abstracts/represents the ability to build a stack, right?
The key idea behind monoids is that they define sequence. To get a
handle on what that means, it helps to think first about the free
monoid. If we have
Stephen Tetley wrote:
Hi Edward
Many thanks.
I've mostly used groupoid for 'string concatenation' on types that I
don't consider to have useful empty (e.g PostScript paths, bars of
music...), as string concatenation is associative it would have been
better if I'd used semigroup in the first
34 matches
Mail list logo