On Sat, May 10, 2014 at 8:22 AM, Roelof Wobben <r.wobben@home.nl> wrote:Is it valid Haskell if I change the putStrln to putStrln ( show n * n) so I do not have to use the let command.
You would need to write putStrLn (show (n * n)) in order for it to parse the way you intend. Function application is left-associative. You could also use print instead of putStrLn, which is shorthand for this.
Another question if I change return n with return () does the loop ever end. My feeling says not because the value of n is never updated for the loop.
Yes, the loop would terminate. The return n in your code is not updating n. The next iteration of the loop receives a new value of n as its argument due to your passing it in with loop (n + 1).