Re: strict bits of datatypes

2007-03-21 Thread John Meacham
On Mon, Mar 19, 2007 at 03:22:29PM +, Simon Peyton-Jones wrote: | This reminds me of something I discovered about using strict fields in | AVL trees (with ghc). Using strict fields results in slower code than | doing the `seq` desugaring by hand. That is bad. Can you send a test case

Re: strict bits of datatypes

2007-03-20 Thread Robert Dockins
On Mar 20, 2007, at 9:53 AM, Malcolm Wallace wrote: Ian Lynagh [EMAIL PROTECTED] wrote: data Fin a = FinCons a !(Fin a) | FinNil w = let q = FinCons 3 q in case q of FinCons i _ - i is w 3 or _|_? Knowing that opinions seem to be heavily stacked against my

RE: strict bits of datatypes

2007-03-20 Thread Bernie Pope
Malcolm wrote: The Haskell Report's definition of `seq` does _not_ imply an order of evaluation. Rather, it is a strictness annotation. That is an important point. Now, in the definition x = x `seq` foo one can also make the argument that, if the value of x (on the lhs of the defn)

Re: strict bits of datatypes

2007-03-19 Thread Adrian Hey
Simon Peyton-Jones wrote: | strict fields have no effect on deconstructing data types. That's GHC's behaviour too. I think it's the right one too! (It's certainly easy to explain.) This reminds me of something I discovered about using strict fields in AVL trees (with ghc). Using strict

RE: strict bits of datatypes

2007-03-19 Thread Simon Peyton-Jones
| This reminds me of something I discovered about using strict fields in | AVL trees (with ghc). Using strict fields results in slower code than | doing the `seq` desugaring by hand. That is bad. Can you send a test case that demonstrates this behaviour? | If I have.. | | data AVL e = E |

Re: strict bits of datatypes

2007-03-18 Thread Jón Fairbairn
[EMAIL PROTECTED] writes: Jón Fairbairn wrote: [EMAIL PROTECTED] writes: Besides, having let q = FinCons 3 q in q not being _|_ crucially depends on memoization. Does it? PS: Your derivations are fine in the case of a non-strict FinCons. But the point is to make in

strict bits of datatypes

2007-03-16 Thread Ian Lynagh
Hi all, A while ago there was a discussion on haskell-cafe about the semantics of strict bits in datatypes that never reached a conclusion; I've checked with Malcolm and there is still disagreement about the right answer. The original thread is around here: http://www.haskell.org/pipermail

Re: strict bits of datatypes

2007-03-16 Thread Ross Paterson
On Fri, Mar 16, 2007 at 05:40:17PM +0100, [EMAIL PROTECTED] wrote: The translation q = FinCons 3 q === (by Haskell 98 report 4.2.1/Strictness Flags/Translation q = (FinCons $ 3) $! q is rather subtle: the first FinCons is a strict constructor whereas the second is the real