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: readIO
Type: Read a => String -> IO a
Description:
Related:

Example 1
Program source: 

main = do x <- rList "[1,3,5,7]"
	  y <- rInt  "5"
	  print (map (y*) x)

rList :: String -> IO [Int]
rList = readIO

rInt :: String -> IO Int
rInt = readIO

Output: [5,15,25,35]

Example 2
Program source: 

main = do x <- aaa "[1,3,5,7]"
	  print x
	  
aaa :: String -> IO (Int,Int,[Int])	  
aaa str = do x <- readIO str
	     return (sum x, product x, x)

Output: (16,105,[1,3,5,7])