[Haskell-cafe] Newbie question: mutually exclusive strict / lazy

Peter Verswyvelen bf3 at telenet.be
Mon Feb 11 03:06:59 EST 2008


Yes, sorry, GHC's strictness analyzer. 

 

What I meant with this email is that I guess that for a strictness analyzer,
the information that a function is strict in an argument *independent from
the other arguments* would not be good enough in itself for optimization, it
would be better to also use the dependencies between the arguments (as in
the case of the if.then.else). 

 

It seems one can indicate in GHC that an argument is strict using
annotiations, but I don't see a way of specifying these dependencies (maybe
this does not make sense, and this is all newbie nonsense). Of course, with
whole program optimization this would not be necessary, but if the compiler
just sees the function signature, he must assume that a lazy argument is
always lazy, independent of the value of other strict arguments no?

 

Cheers,

Peter

 

From: lennart.augustsson at gmail.com [mailto:lennart.augustsson at gmail.com] On
Behalf Of Lennart Augustsson
Sent: maandag 11 februari 2008 0:28
To: Peter Verswyvelen
Cc: haskell-cafe at haskell.org
Subject: Re: [Haskell-cafe] Newbie question: mutually exclusive strict /
lazy

 

I'm not sure what you mean by "the strictness analyzer".  GHC's strictness
analyzer?
I don't know, but I would hope so since it was done already in 1980 by Alan
Mycroft.

  -- Lennart

On Sat, Feb 9, 2008 at 4:33 PM, Peter Verswyvelen <bf3 at telenet.be> wrote:

Consider the function

cond x y z = if x then y else z

I guess we can certainly say cond is strict in x.

But what about y and z?

If x is true,  then cond is strict in y
If x is false, then cond is strict in z

So we can't really say cond is lazy nor strict in its second or third
argument.

Of course, this is the case for many more functions, but in  the case of the
if-then-else primitive, does the strictness analyzer make use of this
"mutually exclusive strictness" fact?

Cheers,
Peter









_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080211/a68fa087/attachment.htm


More information about the Haskell-Cafe mailing list