monads and groups -- instead of loops

Haskellians, Though the actual metaphor in the monads-via-loops doesn't seem to fly with this audience, i like the spirit of the communication and the implicit challenge: find a pithy slogan that -- for a particular audience, like imperative programmers -- serves to uncover the essence of the notion. i can't really address that audience as my first real exposure to programming was scheme and i moved into concurrency and reflection after that and only ever used imperative languages as means to an end. That said, i think i found another metaphor that summarizes the notion for me. In the same way that the group axioms organize notions of symmetry, including addition, multiplication, reflections, translations, rotations, ... the monad(ic axioms) organize(s) notions of snapshot (return) and update (bind), including state, i/o, control, .... In short group : symmetry :: monad : update Best wishes, --greg -- L.G. Meredith Managing Partner Biosimilarity LLC 505 N 72nd St Seattle, WA 98103 +1 206.650.3740 http://biosimilarity.blogspot.com

That's great, unless the imperative programmer happens to be one of
the 90% of programmers that isn't particularly familiar with group
theory...
On 8/1/07, Greg Meredith
Haskellians,
Though the actual metaphor in the monads-via-loops doesn't seem to fly with this audience, i like the spirit of the communication and the implicit challenge: find a pithy slogan that -- for a particular audience, like imperative programmers -- serves to uncover the essence of the notion. i can't really address that audience as my first real exposure to programming was scheme and i moved into concurrency and reflection after that and only ever used imperative languages as means to an end. That said, i think i found another metaphor that summarizes the notion for me. In the same way that the group axioms organize notions of symmetry, including addition, multiplication, reflections, translations, rotations, ... the monad(ic axioms) organize(s) notions of snapshot (return) and update (bind), including state, i/o, control, .... In short
group : symmetry :: monad : update
Best wishes,
--greg
-- L.G. Meredith Managing Partner Biosimilarity LLC 505 N 72nd St Seattle, WA 98103
+1 206.650.3740
http://biosimilarity.blogspot.com _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Andrew,
;-) Agreed! As i said in my previous post, i can't address the imperative
programmer. i really don't think that way and have a hard time understanding
people who do! (-;
Best wishes,
--greg
On 8/1/07, Andrew Wagner
That's great, unless the imperative programmer happens to be one of the 90% of programmers that isn't particularly familiar with group theory...
Haskellians,
Though the actual metaphor in the monads-via-loops doesn't seem to fly with this audience, i like the spirit of the communication and the implicit challenge: find a pithy slogan that -- for a particular audience, like imperative programmers -- serves to uncover the essence of the notion. i can't really address that audience as my first real exposure to
On 8/1/07, Greg Meredith
wrote: programming was scheme and i moved into concurrency and reflection after that and only ever used imperative languages as means to an end. That said, i think i found another metaphor that summarizes the notion for me. In the same way that the group axioms organize notions of symmetry, including addition, multiplication, reflections, translations, rotations, ... the monad(ic axioms) organize(s) notions of snapshot (return) and update (bind), including state, i/o, control, .... In short
group : symmetry :: monad : update
Best wishes,
--greg
-- L.G. Meredith Managing Partner Biosimilarity LLC 505 N 72nd St Seattle, WA 98103
+1 206.650.3740
http://biosimilarity.blogspot.com _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- L.G. Meredith Managing Partner Biosimilarity LLC 505 N 72nd St Seattle, WA 98103 +1 206.650.3740 http://biosimilarity.blogspot.com

Haskellians,
But, along these lines i have been wondering for a while... the monad laws
present an alternative categorification of monoid. At least it's alternative
to monoidoid. In the spirit of this thought, does anyone know of an
expansion of the monad axioms to include an inverse action? Here, i am
following an analogy
monoidoid : monad :: groupoid : ???
i did a search of the literature, but was probably using the wrong
terminology to try to find references. i would be very grateful for anyone
who might point me in the right direction.
My intuition tells me this could be quite generally useful to computing in
situation where boxing and updating have natural (or yet to be discovered)
candidates for undo operations. i'm given to understand reversible computing
might be a good thing to be thinking about if QC ever gets real... ;-)
Best wishes,
--greg
On 8/1/07, Greg Meredith
Haskellians,
Though the actual metaphor in the monads-via-loops doesn't seem to fly with this audience, i like the spirit of the communication and the implicit challenge: find a pithy slogan that -- for a particular audience, like imperative programmers -- serves to uncover the essence of the notion. i can't really address that audience as my first real exposure to programming was scheme and i moved into concurrency and reflection after that and only ever used imperative languages as means to an end. That said, i think i found another metaphor that summarizes the notion for me. In the same way that the group axioms organize notions of symmetry, including addition, multiplication, reflections, translations, rotations, ... the monad(ic axioms) organize(s) notions of snapshot (return) and update (bind), including state, i/o, control, .... In short
group : symmetry :: monad : update
Best wishes,
--greg
-- L.G. Meredith Managing Partner Biosimilarity LLC 505 N 72nd St Seattle, WA 98103
+1 206.650.3740
-- L.G. Meredith Managing Partner Biosimilarity LLC 505 N 72nd St Seattle, WA 98103 +1 206.650.3740 http://biosimilarity.blogspot.com

Math alert: mild category theory. Greg Meredith wrote:
But, along these lines i have been wondering for a while... the monad laws present an alternative categorification of monoid. At least it's alternative to monoidoid.
I wouldn't call monads categorifications of monoids, strictly speaking. A monad is a monoid object in a category of endofunctors (which is a monoidal category under composition). What do you mean by a 'monoidoid'? I only know it as a perverse synonym of 'category' :-).
In the spirit of this thought, does anyone know of an expansion of the monad axioms to include an inverse action? Here, i am following an analogy
monoidoid : monad :: groupoid : ???
First of all, I don't actually know the answer. The canonical option would be a group object in the endofunctor category (let's call the latter C). This does not make sense, however: in order to formulate the axiom for the inverse, we would need the monoidal structure of C (composition of functors) to behave more like a categorical product (to wit, it should have diagonal morphisms diag :: m a -> m (m a) ). Maybe there is a way to get it to work, though. After all, what we (in FP) call a commutative monad, is not commutative in the usual mathematical sense (again, C does not have enough structure to even talk about commutativity).
My intuition tells me this could be quite generally useful to computing in situation where boxing and updating have natural (or yet to be discovered) candidates for undo operations. i'm given to understand reversible computing might be a good thing to be thinking about if QC ever gets real... ;-)
If this structure is to be grouplike, the inverse of an action should be not only a post-inverse, but also a pre-inverse. Is that would you have in mind? (If I'm not making sense, please shout (or ignore ;-) ).) Greetings, Arie

If you haven't read it, you might be interested in the paper Alimarine et al, "There and Back Again: Arrows for Invertible Programming" which can be found at http://www.st.cs.ru.nl/papers/2005/alia2005-biarrowsHaskellWorkshop.pdf Dan Weston Greg Meredith wrote:
Haskellians,
But, along these lines i have been wondering for a while... the monad laws present an alternative categorification of monoid. At least it's alternative to monoidoid. In the spirit of this thought, does anyone know of an expansion of the monad axioms to include an inverse action? Here, i am following an analogy
monoidoid : monad :: groupoid : ???
i did a search of the literature, but was probably using the wrong terminology to try to find references. i would be very grateful for anyone who might point me in the right direction.
My intuition tells me this could be quite generally useful to computing in situation where boxing and updating have natural (or yet to be discovered) candidates for undo operations. i'm given to understand reversible computing might be a good thing to be thinking about if QC ever gets real... ;-)
Best wishes,
--greg

On 1 Aug 2007, at 21:23, Greg Meredith wrote:
But, along these lines i have been wondering for a while... the monad laws present an alternative categorification of monoid. At least it's alternative to monoidoid. In the spirit of this thought, does anyone know of an expansion of the monad axioms to include an inverse action? Here, i am following an analogy
monoidoid : monad :: groupoid : ???
I'm not sure that's the right question. A monoid is a category with one object. A group is a category with one object, where every arrow is an iso. A groupoid is a category (with potentially more than one object), where every arrow is an iso. A monad is monoid in the category of endofunctors. Your "groupad", i.e. a group in the category of endofunctors, would boil down to having a monad m that has an unreturn :: m a -> a. In the light of things like unsafePerformIO, this is maybe not what you want. More interesting, however, is generalizing a monad to a monoid in functor categories in general, as opposed to just endofunctors. You could call this a "monadoid". I've heard Tarmo Uustalu talk about this once (Kan-extensions, coends, *mumble mumble mumble*). Mike Spivey's MSFP paper (http://spivey.oriel.ox.ac.uk/mike/msfp.pdf) mentions A-monads, which is a step in that direction. Anyhow, just a thought. Wouter

On 01/08/07, Greg Meredith
Haskellians,
Though the actual metaphor in the monads-via-loops doesn't seem to fly with this audience, i like the spirit of the communication and the implicit challenge: find a pithy slogan that -- for a particular audience, like imperative programmers -- serves to uncover the essence of the notion. i can't really address that audience as my first real exposure to programming was scheme and i moved into concurrency and reflection after that and only ever used imperative languages as means to an end. That said, i think i found another metaphor that summarizes the notion for me. In the same way that the group axioms organize notions of symmetry, including addition, multiplication, reflections, translations, rotations, ... the monad(ic axioms) organize(s) notions of snapshot (return) and update (bind), including state, i/o, control, .... In short
group : symmetry :: monad : update
Best wishes,
--greg
Hello, I just wrote http://www.haskell.org/haskellwiki/Monads_as_computation after starting to reply to this thread and then getting sidetracked into writing a monad tutorial based on the approach I've been taking in the ad-hoc tutorials I've been giving on #haskell lately. :) It might be worth sifting through in order to determine an anthem for monads. Something along the lines of: "monads are just a specific kind of {embedded domain specific language, combinator library}" would work, provided that the person you're talking to knows what one of those is. :) I've found it very effective to explain those in general and then explain what a monad is in terms of them. I'm not certain that the article is completely finished. I'm a bit tired at the moment, and will probably return to polish the treatment some more when I'm more awake, but I think it's finished enough to usefully get the main ideas across. - Cale
participants (6)
-
Andrew Wagner
-
Arie Peterson
-
Cale Gibbard
-
Dan Weston
-
Greg Meredith
-
Wouter Swierstra