Isn't this tail recursive?

Ronny Wichers Schreur ronny@cs.kun.nl
Fri, 15 Mar 2002 19:29:38 +0100


Simon Marlow writes (to the Haskell mailing list)

>The function as written is only strict in its list argument, and
>its usage site only demands the 'l' argument strictly.  So [..]
>the compiler can't possibly evaluate the accumulating parameters
>of countAll' strictly.

The Clean compiler uses an optimisation that works in this case.
After observing that main evaluates all elements of the tuple
result (because of the shows), the compiler creates a special
version of countAll with (Clean) type
    countAll :: String -> (!Int, !Int, !Int)
and the same for countAll`. It than calls the strictness analyzer
again for these functions.



Cheers,

Ronny Wichers Schreur