Re: [Haskell-cafe] To seq or not to seq, that is the question

2013-03-22 Thread Tom Ellis
On Fri, Mar 08, 2013 at 08:53:15PM -0800, Edward Z. Yang wrote: Are these equivalent? If not, under what circumstances are they not equivalent? When should you use each? evaluate a return b a `seq` return b return (a `seq` b) Furthermore, consider: [...] - Does the

Re: [Haskell-cafe] To seq or not to seq, that is the question

2013-03-10 Thread Albert Y. C. Lai
On 13-03-08 11:53 PM, Edward Z. Yang wrote: Are these equivalent? If not, under what circumstances are they not equivalent? When should you use each? evaluate a return b a `seq` return b return (a `seq` b) Let a = div 0 0 (or whatever pure but problematic expression you like)

Re: [Haskell-cafe] To seq or not to seq, that is the question

2013-03-09 Thread Tom Ellis
On Fri, Mar 08, 2013 at 08:53:15PM -0800, Edward Z. Yang wrote: Are these equivalent? If not, under what circumstances are they not equivalent? When should you use each? evaluate a return b [...] - Use 'evaluate' when you mean to say, Evaluate this thunk to HNF before doing

Re: [Haskell-cafe] To seq or not to seq, that is the question

2013-03-09 Thread Edward Z. Yang
Excerpts from Tom Ellis's message of Sat Mar 09 00:34:41 -0800 2013: I've never looked at evaluate before but I've just found it's haddock and given it some thought. http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Exception-Base.html#v:evaluate Since it is

[Haskell-cafe] To seq or not to seq, that is the question

2013-03-08 Thread Edward Z. Yang
Are these equivalent? If not, under what circumstances are they not equivalent? When should you use each? evaluate a return b a `seq` return b return (a `seq` b) Furthermore, consider: - Does the answer change when a = b? In such a case, is 'return $! b' permissible? -