[Haskell-beginners] define action getInt like getLine

kane96 at gmx.de kane96 at gmx.de
Tue Feb 2 16:20:03 EST 2010


Hi,
how can I write an action 
getInt :: IO Int
that works like 
getLine :: IO String
but for Int instead of String. I know that I can read the input with getLine and then convert it by using read, but don't know how to write it as an action. I tried
getInt :: IO Int
getInt read <- getLine
but that doesn't work.
-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser


More information about the Beginners mailing list