strict bits of datatypes

Simon Peyton-Jones simonpj at microsoft.com
Mon Mar 19 11:22:29 EDT 2007


| 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
|             | N !(AVL e) e !(AVL e)
| .. etc
|
| then presumably this..
|
| case avl of N l e r -> N (f l) e r
|
| desugars to something like ..
|
| case avl of N l e r -> let l' = f l
|                         in l' `seq` r `seq` N l' e r
|
| but IMO it should desugar to..
|
| case avl of N l e r -> let l' = f l
|                         in l' `seq` N l' e r

I agree.  If it doesn't please let me know!

Simon


More information about the Haskell-prime mailing list