ZVON > References > Haskell reference
| Indexes | Syntax | >> Prelude << | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | IO | Directory | System | Time | Locale | CPUTime | Random

Module: Prelude
Function: readLn
Type: Read a => IO a
Description:
Related:

Example 1
Program source: 

main = do x <- getDouble
	  y <- getDouble
          print (x+y)

getDouble :: IO Double
getDouble = readLn

Input: 12

Input: 4.34

Output: 16.34

Example 2
Program source: 

main = do x <- getList
	  print (product x)

getList :: IO [Int]
getList = readLn

Input: [1,2,3,4]

Output: 24

Example 3
Program source: 

main = do x <- aaa
	  print x
	  
aaa :: IO (Int,Int,[Int])	  
aaa = do x <- readLn
	 return (sum x, product x, x)

Input: [1,3,5]

Output: (9,15,[1,3,5])