Re: Re: Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-24 Thread Duncan Coutts
On Sat, 2009-05-23 at 20:42 -0400, Mario Blažević wrote: On Sat 23/05/09 2:51 PM , Duncan Coutts duncan.cou...@worc.ox.ac.uk sent: On Sat, 2009-05-23 at 13:31 -0400, Mario Blažević wrote: ... So the function is not strict, and I don't understand why GHC should evaluate the arguments

Re: Re: Re: Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-24 Thread Mario Blažević
I recommend using -ddump-simpl, as it produces more readable output. Actually, I can't see any effect of that pragma in the core files whatsoever, but it certainly has effect on run time. How about diffing the whole core output (and using -ddump-simpl). If there's a performance

Re: Re: Re: Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-24 Thread Duncan Coutts
On Sun, 2009-05-24 at 12:48 -0400, Mario Blažević wrote: How about diffing the whole core output (and using -ddump-simpl). If there's a performance difference then there must be a difference in the core code too. I can't exactly use diff because the generated identifier names are not the

Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Mario Blažević
On Fri 22/05/09 10:51 AM , John Lato jwl...@gmail.com sent: Hi Mario, It looks like the parallelize function is getting inlined when it's in the same file, but not when it's in a separate file. Adding a {-# INLINE parallelize #-} pragma to the module with parallelize recovers all the

Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Don Stewart
mblazevic: On Fri 22/05/09 10:51 AM , John Lato jwl...@gmail.com sent: Hi Mario, It looks like the parallelize function is getting inlined when it's in the same file, but not when it's in a separate file. Adding a {-# INLINE parallelize #-} pragma to the module with parallelize

Re: Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Mario Blažević
You could probably see exactly what's happening in more detail by going through the Core output. Thank you, this advice helped. The Core output indicates that function `test' evaluates the arguments to `parallelize' before it calls it. In other words, the call to `parallelize' is optimized

Re: Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Max Rabkin
On Sat, May 23, 2009 at 7:31 PM, Mario Blažević mblaze...@stilo.com wrote: Does anybody know of a pragma or another way to make a function *non-strict* even if it does always evaluate its argument? In other words, is there a way to selectively disable the strictness optimization? parallelize

Re: Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Alexander Dunlap
On Sat, May 23, 2009 at 11:34 AM, Max Rabkin max.rab...@gmail.com wrote: On Sat, May 23, 2009 at 7:31 PM, Mario Blažević mblaze...@stilo.com wrote: Does anybody know of a pragma or another way to make a function *non-strict* even if it does always evaluate its argument? In other words, is

Re: Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Duncan Coutts
On Sat, 2009-05-23 at 13:31 -0400, Mario Blažević wrote: You could probably see exactly what's happening in more detail by going through the Core output. Thank you, this advice helped. The Core output indicates that function `test' evaluates the arguments to `parallelize' before it

Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Mario Blažević
On Sat 23/05/09 4:15 PM , Alexander Dunlap alexander.dun...@gmail.com sent: Does anybody know of a pragma or another way to make a function *non-strict* even if it does always evaluate its argument? In other words, is there a way to selectively disable the strictness optimization?

Re: Re: Re: [Haskell-cafe] Re: A problem with par and modules boundaries...

2009-05-23 Thread Mario Blažević
On Sat 23/05/09 2:51 PM , Duncan Coutts duncan.cou...@worc.ox.ac.uk sent: On Sat, 2009-05-23 at 13:31 -0400, Mario Blažević wrote: ... So the function is not strict, and I don't understand why GHC should evaluate the arguments before the call. Right, it's lazy in the first and strict in