From: michiexile

2007-10-16 11:13 pm (UTC)

So, now, obviously the question is whether Mndn(C) corresponds to composing n monads. From: pozorvlak

2007-10-17 07:36 am (UTC)

Yep :-) I'm hoping this is in the paper. Actually, I think we're most of the way there with the cases n=2 and n=3: an object in Mnd4(C) is a composable pair of (composable pairs of monads), so (and this is the dubious step) a composable quartet of monads, and so on... Except that argument can't work in general, because then an object of Mnd5(C) would be a composable triple of composable pairs of monads, and so (ha!) a composable sextuple of monads!



Hmmm.... From: pozorvlak

2007-10-17 08:11 am (UTC)

We give a framework for combining n monads on the same category via distributive laws satisfying Yang-Baxter equations, extending the classical result of Barr and Wells which combines two monads via one distributive law. We show that this corresponds to iterating n-times the process of taking the 2-category of monads in a 2-category, extending the result of Street characterising distributive laws. We show that this framework can be used to construct the free strict n-category monad on n-dimensional globular sets; we first construct for each i a monad for composition along bounding i-cells, and then we show that the interchange laws define distributive laws between these monads, satisfying the necessary Yang-Baxter equations. So it looks like the answer is "yes" :-)

From the abstract:So it looks like the answer is "yes" :-) From: pozorvlak

2007-10-19 10:54 am (UTC)





The 2-category Mnd(C) has

- objects: objects A of C, together with a monad T on A (hence, quadruples (A,T,μ,η), thus making rather a nonsense of the term "triple" for monad :-) )

- 1-cells: lax maps of monads (ie, a 1-cell F:A → A' in C and a 2-cell φ T A--->A | φ | F| => |F v T' v A'-->A' making some diagrams commute

- 2-cells: 2-cells of C doing The Right Thing wrt 1-cells.



So a monad in Mnd(C) is a monad in C, plus a 1-cell (F,φ): (A,T) -> (A, T) and some 2-cells μ', η'. The axioms imply that F:A → A is a monad with μ' and η', and φ is a distributive law TF → FT. Repeating this construction gives you an object with n monads on it, and enough distributivity to give a monad structure to the composite.



The content of the paper is thus (a) what I just said, and (b) your coherence axioms for n composable monads stay sane: you just need the usual axioms for a distributive law and the Yang-Baxter equations, no matter how high n goes. Which is pretty cool, I think :-) OK, I talked to Tom about this yesterday, and here's roughly how it works:The 2-category Mnd(C) has- objects: objects A of C, together with a monad T on A (hence, quadruples (A,T,μ,η), thus making rather a nonsense of the term "triple" for monad :-) )- 1-cells: lax maps of monads (ie, a 1-cell F:A → A' in C and a 2-cell φmaking some diagrams commute- 2-cells: 2-cells of C doing The Right Thing wrt 1-cells.So a monad in Mnd(C) is a monad in C, plus a 1-cell (F,φ): (A,T) -> (A, T) and some 2-cells μ', η'. The axioms imply that F:A → A is a monad with μ' and η', and φ is a distributive law TF → FT. Repeating this construction gives you an object with n monads on it, and enough distributivity to give a monad structure to the composite.The content of the paper is thus (a) what I just said, and (b) your coherence axioms for n composable monads stay sane: you just need the usual axioms for a distributive law and the Yang-Baxter equations, no matter how high n goes. Which is pretty cool, I think :-) From: (Anonymous)

2009-11-14 10:53 pm (UTC)

Distributive Law and Transformers Some monad transformers are probably related to distributive laws. For instance, MaybeT:



newtype MaybeT m a = MT (m (Maybe a))



So the Maybe transformer is actually a permutation of Maybe past whatever monad you're wrapping. And you can probably create a transformer based on a distributive law.



newtype DT m n a = DT (n (m a))



join :: DT m n (DT m n a) -> DT m n a

-- join :: n (m (n (m a))) -> n (m a)

join = <use distributivity>



However, other transformers let you combine monads that don't have (obvious to me, at least) distributive laws. For instance:



newtype StateT s m a = StateT (s -> m (s, a))



The m is only permuted half-way through the normal state monad s -> (s, a) . And I don't know of any distributive law:



forall m. Monad m => (forall a. State (m a) -> m (State a))



or vice versa, or even for particular monads m (off the top of my head). So transformers seem more generally useful (State is a pretty common monad to want to build into a stack), despite the unfortunate fact that I know of no categorical grounding for them (in fact, all the categorically well-grounded monad composition schemes I've seen require you to sacrifice something useful about transformers, unfortunately). From: (Anonymous)

2009-11-16 02:55 pm (UTC)

(co)monads over (co)Kleisli categories I have had (co)monads over arbitrary categories implemented in category-extras for a while. This lets you describe things like a state-in-context monad over ST that lets you describe memoized comonadic computation.



That said, they are somewhat weak, because you can't define certain monads once and for all across all CCC's, because Haskell's type system gets in your way. i.e. the reader monad should be definable once and for all, but the need to add some kind of newtype wrapper and remove it in order to dispatch properly breaks it irrevocably. I meant to write up an article on that at some point, but more or less just kind of put it down once I realized how little I could actually use it for from a library writing perspective.



Any monad in Mnd(Mnd(C)) giving rise to 3 monads result is new to me though, and very cool!