I tried your example in GHC 6.10 and isum appears to work fine.
The type of 1000 gets defaulted to Integer, a specialized version
of isum for Integer is then created, the strictness analyzer
determines that isum is strict in s, and the code generator produces a
loop. (If you want to look at
I tried your example in GHC 6.10 and isum appears to work fine.
The type of 1000 gets defaulted to Integer, a specialized version
of isum for Integer is then created, the strictness analyzer
determines that isum is strict in s, and the code generator produces a
loop. (If you want to look
Luke Palmer-2 wrote:
I would like to know or to develop a way to allow abstract
analysis of time and space complexity.
In the same way that type inference and strictness analysis can be
seen as instances of abstract interpretation, so can complexity
inference. I agree that the interplay
David Menendez-2 wrote:
On Mon, 3 Nov 2008, Luke Palmer wrote:
I was actually being an annoying purist. f is strict means f _|_ =
_|_, so strictness is a semantic idea, not an operational one.
I think Luke was commenting on the terminology, not the optimization.
We have a tendency to
Patai Gergely [EMAIL PROTECTED] writes:
My only problem is that if I try to write a program without
thinking about performance first and not bothering with annotations as
long as it works, I end up with something that's practically
impossible to profile as the costs spread everywhere.
I
Thanks everyone for the answers. I understood the underlying mechanism,
and I did see that turning on optimisation helps, as I said in the
comments. I just wasn't aware that this analysis is not turned on by
default, my bad for not reading the FM.
So the final verdict is that type and strictness
On Tue, 2008-11-04 at 12:18 +0100, Patai Gergely wrote:
Thanks everyone for the answers. I understood the underlying mechanism,
and I did see that turning on optimisation helps, as I said in the
comments. I just wasn't aware that this analysis is not turned on by
default, my bad for not
Nonsense, isum is strict in s. If s is bottom, isum will always return bottom.
This is the definition of being strict.
-- Lennart
On Mon, Nov 3, 2008 at 10:35 PM, Don Stewart [EMAIL PROTECTED] wrote:
frantisek.kocun:
yet I need to add a $! to the recursive call of isum to get a truly
On Mon, 2008-11-03 at 13:31 +0100, Patai Gergely wrote:
Hi everyone,
I was experimenting with simple accumulator functions, and found that an
apparently tail recursive function can easily fill the stack. Playing
around with ghc and jhc gave consistently unpleasant results. Look at
this
patai_gergely:
Hi everyone,
I was experimenting with simple accumulator functions, and found that an
apparently tail recursive function can easily fill the stack. Playing
around with ghc and jhc gave consistently unpleasant results. Look at
this program:
%%%
-- ghc: no, ghc
yet I need to add a $! to the recursive call of isum to get a truly
iterative ???
Wait a minute Patai. How would you do that? I'm only beginner I thought I
can only add strict ! to data parameters. But to make isum function strict
would be helpful.
Thanks
On Mon, Nov 3, 2008 at 7:36 PM, Don
frantisek.kocun:
yet I need to add a $! to the recursive call of isum to get a truly
iterative ???
Wait a minute Patai. How would you do that? I'm only beginner I thought I
can only add strict ! to data parameters. But to make isum function
strict would be helpful.
On Mon, Nov 3, 2008 at 2:35 PM, Don Stewart [EMAIL PROTECTED] wrote:
Consider this program,
isum 0 s = s
isum n s = isum (n-1) (s+n)
main = case isum 1000 0 {- rsum 1000 -} of
0 - print 0
x - print x
On Mon, Nov 3, 2008 at 2:49 PM, Luke Palmer [EMAIL PROTECTED] wrote:
I am confused about your usage of strict. Optimizations are not
supposed to change semantics, so I don't know how it is possible to
make a function strict by turning on optimizations. This function was
always strict in s,
lrpalmer:
On Mon, Nov 3, 2008 at 2:35 PM, Don Stewart [EMAIL PROTECTED] wrote:
Consider this program,
isum 0 s = s
isum n s = isum (n-1) (s+n)
main = case isum 1000 0 {- rsum 1000 -} of
0 - print 0
On Mon, Nov 3, 2008 at 2:54 PM, Don Stewart [EMAIL PROTECTED] wrote:
lrpalmer:
On Mon, Nov 3, 2008 at 2:35 PM, Don Stewart [EMAIL PROTECTED] wrote:
Consider this program,
isum 0 s = s
isum n s = isum (n-1) (s+n)
main = case isum 1000 0 {- rsum
On Mon, 3 Nov 2008, Luke Palmer wrote:
On Mon, Nov 3, 2008 at 2:54 PM, Don Stewart [EMAIL PROTECTED] wrote:
Optimisations enable strictness analysis.
I was actually being an annoying purist. f is strict means f _|_ =
_|_, so strictness is a semantic idea, not an operational one.
On Mon, Nov 3, 2008 at 5:39 PM, Henning Thielemann
[EMAIL PROTECTED] wrote:
On Mon, 3 Nov 2008, Luke Palmer wrote:
On Mon, Nov 3, 2008 at 2:54 PM, Don Stewart [EMAIL PROTECTED] wrote:
Optimisations enable strictness analysis.
I was actually being an annoying purist. f is strict means f
Don Stewart:
Optimisations enable strictness analysis.
Luke Palmer:
I was actually being an annoying purist. f is strict means f _|_ =
_|_, so strictness is a semantic idea, not an operational one.
Optimizations can change operation, but must preserve semantics.
Henning Thielemann:
Maybe I
Patai Gergely wrote:
Hi everyone,
I was experimenting with simple accumulator functions, and found that an
apparently tail recursive function can easily fill the stack. Playing
around with ghc and jhc gave consistently unpleasant results. Look at
this program:
%%%
-- ghc: no, ghc -O3:
20 matches
Mail list logo