[Haskell-cafe] Order of Evaluation

Daniil Elovkov daniil.elovkov at googlemail.com
Sat May 10 08:50:36 EDT 2008


You may find this paper useful


It should give you the general feeling of how things are actually executed.

It's quite old, some things in GHC have changed, but the overall scheme, 
I believe, is the same. The competent people will correct me, if I'm wrong.

PR Stanley wrote:
> Hi
>  (take 4 . map (>0)) (f s t)
>  where
>     s = 2 : t
>     t = 3 : s
>  f = zipWith (-)
> What would be the order of evaluation for the above code? How would I 
> illustrate the evaluation step-by-step?
> I'm guessing that  the code necessitates lazy evaluation and as such it 
> starts with take then it applies f which in turn applies s and t and 
> zipWith until the first element satisfies the predicate in map and This 
> is repeated 4 times
> What does the list think?
> Many thanks,
> Paul
> P.S. I'm not done with induction. I'm just letting it rst for a bit.

More information about the Haskell-Cafe mailing list