Re: STM experiment

2009-10-12 Thread Carsten Schultz
Brent Yorgey schrieb: On Fri, Oct 02, 2009 at 06:16:49PM +0200, Luca Ciciriello wrote: Compiling this module with: ghc --make Main.hs -o Main and launcing ./Main the result is just: Terminal world Also, the reason you only get world here is likely because the main thread prints world

RE: STM experiment

2009-10-12 Thread Luca Ciciriello
...@codimi.de Date: Mon, 12 Oct 2009 13:34:36 +0200 Subject: Re: STM experiment Brent Yorgey schrieb: On Fri, Oct 02, 2009 at 06:16:49PM +0200, Luca Ciciriello wrote: Compiling this module with: ghc --make Main.hs -o Main and launcing ./Main the result is just: Terminal Also

Re: STM experiment

2009-10-12 Thread Carsten Schultz
Luca Ciciriello schrieb: Thanks Carsten, I've compiled your example and all works as expected. Just a note. If I load the module in GHCi (intead of compiling it) and launch main function the result is quite strange. I obtain: He lwloorld So we actually observe the concurrency here,

Re: STM experiment

2009-10-02 Thread Daniel Peebles
Hi Luca, Just in case you weren't aware of it, your example didn't actually contain any STM (beyond the import), just regular Haskell IO-based concurrency. But the answer to your question is that there's no synchronization on writing to a file descriptor, so both threads are simultaneously

Re: STM experiment

2009-10-02 Thread Luca Ciciriello
Thanks Dan. I understand, your explanation is clear. I just need to study more Haskell. Im' just a beginner but very enthusiastic learning this think-different language (I'm a 12-year experienced C++ programmer). Thanks again. Luca. On Oct 2, 2009, at 6:28 PM, Daniel Peebles wrote: Hi

Re: STM experiment

2009-10-02 Thread Brent Yorgey
On Fri, Oct 02, 2009 at 06:16:49PM +0200, Luca Ciciriello wrote: Compiling this module with: ghc --make Main.hs -o Main and launcing ./Main the result is just: Terminal world Also, the reason you only get world here is likely because the main thread prints world and exits before the