Re: seq vs. pseq

2006-11-08 Thread Simon Marlow
Ross Paterson wrote: On Mon, Nov 06, 2006 at 12:53:55PM +, Simon Marlow wrote: Incedentally, this is also one reason I think lazy I/O is a wart (despite its obvious usefulness): because it necessarily requires talking about evaluation order. What is lazy output? Buffering? Well ok, "

Re: seq vs. pseq

2006-11-08 Thread Simon Marlow
Ross Paterson wrote: On Mon, Nov 06, 2006 at 06:25:48PM +, Malcolm Wallace wrote: When I use `seq`, it is sometimes in a construction like unsafePerformIO (emit "squawk!) `seq` x where I am trying to force the impure side-effect to happen, exactly and immediately before x is evaluated.

Re: seq vs. pseq

2006-11-08 Thread Simon Marlow
Malcolm Wallace wrote: Simon Marlow <[EMAIL PROTECTED]> wrote: When I use `seq`, it is sometimes in a construction like unsafePerformIO (emit "squawk!) `seq` x My take on this kind of thing is that if you want a specific operational behaviour, then you're doing something implementation-

Re: seq vs. pseq

2006-11-07 Thread Malcolm Wallace
Simon Marlow <[EMAIL PROTECTED]> wrote: > > When I use `seq`, it is sometimes in a construction like > > > > unsafePerformIO (emit "squawk!) `seq` x > > My take on this kind of thing is that if you want a specific > operational behaviour, then you're doing something > implementation-specifi

Re: seq vs. pseq

2006-11-07 Thread Simon Marlow
Malcolm Wallace wrote: Ross Paterson <[EMAIL PROTECTED]> wrote: When I've used seq, it's to ensure that a function is strict in that argument, and therefore has been evaluated before the function is called. (If the language had unlifted types, I might have used those instead). Beyond that, I d

Re: seq vs. pseq

2006-11-07 Thread Ross Paterson
On Mon, Nov 06, 2006 at 12:53:55PM +, Simon Marlow wrote: > Incedentally, this is also one reason I think lazy I/O is a wart (despite > its obvious usefulness): because it necessarily requires talking about > evaluation order. What is lazy output? Buffering? ___

Re: seq vs. pseq

2006-11-07 Thread Ross Paterson
On Mon, Nov 06, 2006 at 05:21:04PM +, Ross Paterson wrote: > Apart from that, the only thing wrong with seq is its name. I take back that part. Simon's "strong hint" suggestion looks like a good idea. It's just one of a number of implicit assumptions we make about operational behaviour. Aft

Re: seq vs. pseq

2006-11-06 Thread Ross Paterson
On Mon, Nov 06, 2006 at 06:25:48PM +, Malcolm Wallace wrote: > When I use `seq`, it is sometimes in a construction like > > unsafePerformIO (emit "squawk!) `seq` x > > where I am trying to force the impure side-effect to happen, exactly and > immediately before x is evaluated. Whilst thi

Re: seq vs. pseq

2006-11-06 Thread Malcolm Wallace
Ross Paterson <[EMAIL PROTECTED]> wrote: > When I've used seq, it's to ensure that a function is strict in that > argument, and therefore has been evaluated before the function is > called. (If the language had unlifted types, I might have used those > instead). Beyond that, I don't care exactly w

Re: seq vs. pseq

2006-11-06 Thread Seth Kurtzberg
On Mon, November 6, 2006 9:21 am, Ross Paterson wrote: > On Mon, Nov 06, 2006 at 01:53:52PM +, Malcolm Wallace wrote: >> So the doubly bizarre thing is that, actually, `seq` does not control >> the evaluation order (which is the only valid reason for wanting to use >> it in the first place), b

Re: seq vs. pseq

2006-11-06 Thread Ross Paterson
On Mon, Nov 06, 2006 at 01:53:52PM +, Malcolm Wallace wrote: > So the doubly bizarre thing is that, actually, `seq` does not control > the evaluation order (which is the only valid reason for wanting to use > it in the first place), but nevertheless it undesirably changes the > semantics of pro

Re: seq vs. pseq

2006-11-06 Thread Simon Marlow
Malcolm Wallace wrote: Indeed, `seq` is widely viewed as a wart on the language _because_ it specifies the evaluation order, which is something otherwise avoided in the Report. I don't agree with that statement - the main problem with (polymorphic) seq is that its existence implies that the f

Re: seq vs. pseq

2006-11-06 Thread Malcolm Wallace
Simon Marlow <[EMAIL PROTECTED]> wrote: > The report is in general very careful to say absolutely *nothing* > about evaluation order, leaving the implementation free to choose, Yes, this is a highly desirable goal. > However, having said all that, arguably an exception should be made in > this

Re: seq vs. pseq

2006-11-06 Thread Simon Marlow
Malcolm Wallace wrote: Simon Marlow <[EMAIL PROTECTED]> wrote: The difference is subtle. The semantics of seq and pseq are identical; however, GHC can see that seq is strict in both its arguments and hence could choose to evaluate them in either order, whereas pseq is only strict in its fir

Re: seq vs. pseq

2006-10-27 Thread Malcolm Wallace
Simon Marlow <[EMAIL PROTECTED]> wrote: > The difference is subtle. The semantics of seq and pseq are > identical; however, GHC can see that seq is strict in both its > arguments and hence could choose to evaluate them in either order, > whereas pseq is only strict in its first argument as far