[Haskell-beginners] having trouble with helloworld style program

Sunil S Nandihalli sunil.nandihalli at gmail.com
Mon Aug 8 13:39:29 CEST 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110808/4e18bb69/attachment.htm>


More information about the Beginners mailing list