
On Mon, Aug 8, 2011 at 11:08 AM, David Place
main =do
x<-getLine
y<-return x
print $ stringToInt y
This is exactly equivalent to the other methods, but has the additional 'return', which is a no-op. Please do not suggest such a style.
Really? Without the return it will not work. So, it isn't a noop. Stylistically, I like it better than the 'let' in 'do' notation.
I think he means that the entire line is a no-op. The line:
y <- return x
is equivalent to:
let y = x
and since re-naming a value doesn't perform any computation, you may as well delete the line and use 'x' everywhere you would have used 'y':
main =do x<-getLine print $ stringToInt x
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners