Hi Paolo,

On Dec 5, 2007 2:09 PM, Paulo J. Matos <[EMAIL PROTECTED]> wrote:
> I'm glad that my initial post generated such an interesting discussion
> but I'm still not understanding why the first version of findAllPath
> seems to be computing the whole list even when I just request the
> head, while the second one doesn't.

Because the function starts its work with

    if isNothing lfpaths && isNothing rtpaths
    then Nothing
    else ...

which forces the evaluation of 'lfpaths' and 'rtpaths' to see whether
they are Just or Nothing, which recursively forces the evaluation of
findAllPath for the whole tree.

Hope this helps,
- Benja
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to