Re: Combining distinct-thread state monads?

2004-01-08 Thread Daan Leijen
Hi Mark, The state transformer approach seems to have advantageous in that it provides a framework for building new monads from old, and accessing the components. One disadvantage is that it lacks symmetry in that one monad is arbitrarily chosen to sit inside the other. You may want to read "comp

Re: Combining distinct-thread state monads?

2004-01-08 Thread Wolfgang Jeltsch
Am Donnerstag, 8. Januar 2004 03:20 schrieben Sie: > [...] > Thanks for your informative reply. You're welcome. > [...] > One disadvantage is that it lacks symmetry in that one monad is arbitrarily > chosen to sit inside the other. Yes, I see this as a disadvantage, too. > I found another app

Re: Combining distinct-thread state monads?

2004-01-08 Thread Dr Mark H Phillips
Hi Wolfgang, Thanks for your informative reply. At first I didn't understand it, but a search on "StateT" lead me to the paper "Monad Transformers and Modular Interpreters" by Liang, Hudak and Jones, which clarified some of the ideas for me. The state transformer approach seems to have advantage

Re: Combining distinct-thread state monads?

2004-01-06 Thread Wolfgang Jeltsch
Hello, your problem can be solved with StateT: (warning: untested code) First we want to execute two independent state threads: start1 :: Monad m => StateT Int m startOutput1 start1 = start2 :: Monad m => StateT Bool m startOutput2 start2 = After this there is a part where we

Combining distinct-thread state monads?

2004-01-06 Thread Dr Mark H Phillips
Hi, I am still learning about monads. I have a problem in mind and am wondering whether state monads are able to solve it. The difficulty is that it would necessitate the interaction of two state threads and I'm not sure whether Haskell state monads allow this. Let me explain what I'm getting a