[Haskell-cafe] Re: philosophy of Haskell

2010-08-27 Thread Paolo G. Giarrusso
Hi all, how comes that it is considered safe to use Control.Monad.Primitive.primitive and .internal [1]? Why aren't they called, i.e.., unsafePrimitive and unsafeInternal? primitive allows accessing the RealWorld state and, say, passing it to two different IO actions unwrapped through internal? Yo

[Haskell-cafe] Re: philosophy of Haskell

2010-08-20 Thread Heinrich Apfelmus
Ertugrul Soeylemez wrote: Heinrich Apfelmus wrote: In particular, the World -> (a,World) model is unsuitable even without concurrency because it cannot distinguish loop, loop' :: IO () loop = loop loop' = putStr "c" >> loop' I interpret the "EDSL model" to be the operational sema

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 >

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' =

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 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

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 >

[Haskell-cafe] Re: philosophy of Haskell

2010-08-18 Thread Ertugrul Soeylemez
Heinrich Apfelmus wrote: > In particular, the World -> (a,World) model is unsuitable even without > concurrency because it cannot distinguish > > loop, loop' :: IO () > loop = loop > loop' = putStr "c" >> loop' > > I interpret the "EDSL model" to be the operational semantics presente

[Haskell-cafe] Re: philosophy of Haskell

2010-08-18 Thread Heinrich Apfelmus
Bill Atkins wrote: 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 FFI. And maybe not c

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-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 s

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

2010-08-15 Thread Bill Atkins
On Sunday, August 15, 2010, Tillmann Rendel 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 actions of some concurrent thread.

[Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Ertugrul Soeylemez
"Patai Gergely" wrote: > > No. As you say the world1 value is immutable, but that's not > > contradictory. If between 'getLine' and 'print' something was done > > by a concurrent thread, then that change to the world is captured by > > 'print'. > > Well, that's technically true, but it basicall

[Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Ertugrul Soeylemez
Brandon S Allbery KF8NH wrote: > 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

[Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Ertugrul Soeylemez
Tillmann Rendel 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 actions of some > >> concurrent thread. > > > > the wh

[Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Patai Gergely
> No. As you say the world1 value is immutable, but that's not > contradictory. If between 'getLine' and 'print' something was done by a > concurrent thread, then that change to the world is captured by 'print'. Well, that's technically true, but it basically amounts to saying that the 'model' of

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 par

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 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 concurre

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[2]: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Bulat Ziganshin
Hello Tillmann, Sunday, August 15, 2010, 7:40:54 PM, you 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 W

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 a

[Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Ertugrul Soeylemez
"Patai Gergely" wrote: > > I don't agree. A concurrent change is the effect of an IO action, > > not of the thread. For example if a concurrent thread writes to an > > MVar, then that change becomes the effect of the next takeMVar, > > which gets executed. If a concurrent thread changes a file

[Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Patai Gergely
> I don't agree. A concurrent change is the effect of an IO action, not > of the thread. For example if a concurrent thread writes to an MVar, > then that change becomes the effect of the next takeMVar, which gets > executed. If a concurrent thread changes a file on disk, then that > changing be

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

2010-08-15 Thread Conal Elliott
On Sat, Aug 14, 2010 at 10:11 PM, Bill Atkins 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. (Really, it dep

[Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Ertugrul Soeylemez
Conal Elliott wrote: > On Sat, Aug 14, 2010 at 9:27 AM, Ertugrul Soeylemez wrote: > > > Conal Elliott wrote: > > > > > > There are various models. One (the state monad model) of them > > > > would desugar this to: > > > > > > > > \world0 -> > > > > let (x, world1) = getLine world0 > > > >

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 > c

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

2010-08-13 Thread Conal Elliott
On Sat, Aug 14, 2010 at 9:27 AM, Ertugrul Soeylemez wrote: > Conal Elliott 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 > > >

[Haskell-cafe] Re: philosophy of Haskell

2010-08-13 Thread Ertugrul Soeylemez
Conal Elliott 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 > > world3 = print (x+2) world2 > > in world3 > > Hi Ertugrul, > > This state mon

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, sin

[Haskell-cafe] Re: philosophy of Haskell

2010-08-09 Thread Ertugrul Soeylemez
jerzy.karczmarc...@info.unicaen.fr wrote: > Alberto G. Corona writes: > > > (...) Desugarize the "do" notation, after that, desugarize the >>= > > and >> operators down to the function call notation and suddenly > > everithing lost its magic because it becomes clear that a haskell > > monad is a