Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-18 Thread Dan Doel
On Wednesday 18 August 2010 11:14:06 am Ertugrul Soeylemez wrote: loop, loop' :: IO () loop = loop loop' = putStr c loop' Huh?! Let's translate them. 'loop' becomes: undefined But 'loop\'' becomes: \w0 - let (w1, ()) = putStr c w0 in loop w1

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-18 Thread Gregory Crosswhite
On 08/18/10 11:30, Dan Doel wrote: Now, moving to the two loops: loop = loop loop' = \w0 - let (w1, ()) = putStr c w0 in loop' w1 How are we to distinguish between these? I know of exactly one Haskell function that can do so: seq. And this is only because it can distinguish bottom

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-18 Thread Gregory Crosswhite
On 08/18/10 11:30, Dan Doel wrote: By contrast, here: http://code.haskell.org/~dolio/agda-share/html/IOE.html is a term model of IO. It's in Agda, for some proofs, but it's easily done in GHC. And if we write the above loops in this model, we get: loop = loop ==

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-18 Thread Gregory Crosswhite
On 08/18/10 12:04, Gregory Crosswhite wrote: Now we have that loop' = loop''. Oops! I meant that loop' = loop'' in the world passing model, so that if loop' = \w0 - let (w1, ()) = putStr c w0 in loop' w1 loop'' = \w0 - let (w1, ()) = putStr c w1 in loop' w1 then loop' = loop''

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-18 Thread Dan Doel
On Wednesday 18 August 2010 2:50:00 pm Gregory Crosswhite wrote: On 08/18/10 11:30, Dan Doel wrote: Now, moving to the two loops: loop = loop loop' = \w0 - let (w1, ()) = putStr c w0 in loop' w1 How are we to distinguish between these? I know of exactly one Haskell function that

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Conal Elliott
On Sat, Aug 14, 2010 at 10:11 PM, Bill Atkins watk...@alum.rpi.edu wrote: On Saturday Aug 14, 2010, at 12:50 AM, Conal Elliott wrote: And the IO monad is what Jerzy asked about. I'm pointing out that the state monad does not capture concurrency, and the EDSL model does not capture FFI.

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Tillmann Rendel
Ertugrul Soeylemez wrote: let (x, world1) = getLine world0 world2 = print (x+1) world1 If between 'getLine' and 'print' something was done by a concurrent thread, then that change to the world is captured by 'print'. But in a world passing interpretation of IO, print is supposed to be

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Tillmann Rendel
Bulat Ziganshin wrote: But in a world passing interpretation of IO, print is supposed to be a pure Haskell function. So the value world2 can only depend on the values of print and world1, but not on the actions of some concurrent thread. the whole World includes any concurrent thread though ;)

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/15/10 11:40 , Tillmann Rendel wrote: But in a world passing interpretation of IO, print is supposed to be a pure Haskell function. So the value world2 can only depend on the values of print and world1, but not on the actions of some concurrent

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Tillmann Rendel
Brandon S Allbery KF8NH wrote: I am confused by this discussion. I originally thought some time back that IO was about world passing, but in fact it's just handing off a baton to insure that a particular sequence of IO functions is executed in the specified sequence and not reordered. Nothing

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 8/15/10 13:27 , Tillmann Rendel wrote: Brandon S Allbery KF8NH wrote: I am confused by this discussion. I originally thought some time back that IO was about world passing, but in fact it's just handing off a baton to insure that a particular

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Bill Atkins
On Sunday, August 15, 2010, Tillmann Rendel ren...@mathematik.uni-marburg.de wrote: Bulat Ziganshin wrote: But in a world passing interpretation of IO, print is supposed to be a pure Haskell function. So the value world2 can only depend on the values of print and world1, but not on the

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread wren ng thornton
Brandon S Allbery KF8NH wrote: only ordering of calls in the *current* thread of execution. (Which, hmm, implies that unsafePerformIO and unsafeInterleaveIO are conceptually similar to forkIO.) Implementationally they are very similar (at least as far as the baton is concerned). How hard we

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08/15/2010 08:32 PM, wren ng thornton wrote: Brandon S Allbery KF8NH wrote: only ordering of calls in the *current* thread of execution. (Which, hmm, implies that unsafePerformIO and unsafeInterleaveIO are conceptually similar to forkIO.)

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-14 Thread Bill Atkins
On Saturday Aug 14, 2010, at 12:50 AM, Conal Elliott wrote: And the IO monad is what Jerzy asked about. I'm pointing out that the state monad does not capture concurrency, and the EDSL model does not capture FFI. (Really, it depends which EDSL model. I haven't seen one that can capture

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-13 Thread Conal Elliott
There are various models. One (the state monad model) of them would desugar this to: \world0 - let (x, world1) = getLine world0 world2 = print (x+1) world1 world3 = print (x+2) world2 in world3 Hi Ertugrul, This state monad model does not really work for IO, since it

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-13 Thread Conal Elliott
On Sat, Aug 14, 2010 at 9:27 AM, Ertugrul Soeylemez e...@ertes.de wrote: Conal Elliott co...@conal.net wrote: There are various models. One (the state monad model) of them would desugar this to: \world0 - let (x, world1) = getLine world0 world2 = print (x+1) world1