
Ohh, I missed to see reply from others. Anyway I am putting one more method
just from my side
module Main where
import Prelude
stringToInt::String->Int
stringToInt str = read str
main =do
x<-getLine
y<-return x
print $ stringToInt y
Regards
Sukumaran
On Mon, Aug 8, 2011 at 5:33 PM, Sukumaran A
Dear Sunil I am very new to haskell, started reading http://learnyouahaskell.com and completed upto functionally-solving-problems. In your example, it is very clear where the issue is
Please check below code and try to infer what is wrong with you. Please let me know if you want explanation from my side.
module Main where import Prelude
stringToInt::String->Int stringToInt str = read str
main =do x<-getLine let y=stringToInt x print y
On Mon, Aug 8, 2011 at 5:09 PM, Sunil S Nandihalli < sunil.nandihalli@gmail.com> wrote:
Hello everybody, All I want to do in the following code is to read an integer from stdin and print it back to stdout. Can somebody help me fix my code snippet below..
Thanks, Sunil
module Main where import Prelude
stringToInt::String->Int stringToInt str = read str
main = do x<-getLine y<-stringToInt x print y
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners