catamorphism at gmail.com
Tue Mar 6 14:00:10 EST 2007
On 3/6/07, Dave at haskell.org <Dave at haskell.org> wrote:
> Does the following code increase the level of recursion
> once for each input line or is the recursive construct
> converted to an iteration?
As was pointed out, tail recursion in Haskell isn't straightforward.
The answer may also depend on which implementation of Haskell you're
using. But I assume you mean GHC.
If you want to know for sure, I suggest reading the intermediate code
produced by GHC for this example (or perhaps an even smaller version
of your example that retains the recursive structure but doesn't do
IO). For some help with that, check out the manual's section on "How
to read Core Syntax":
and ask on this mailing list if you have any questions.
Depending on why you're asking, actually reading the intermediate code
may be overkill, but since you didn't say why you wanted to know, I
assume you're just curious.
Kirsten Chevalier* chevalier at alum.wellesley.edu *Often in error, never in doubt
"Instant gratification takes too long."--Carrie Fisher
More information about the Haskell-Cafe