
Sukumaran A
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
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. To be honest, I think the best coding style for this particular example is not to use do-notation at all: module Main where main :: IO () main = let stringToInt :: String -> Int stringToInt = read in fmap stringToInt getLine >>= print Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/