Read File

Arjan van IJzendoorn afie@cs.uu.nl
Wed, 1 May 2002 13:04:23 +0200


Hello,

> text file has [1,2,3,5]
> and when I read this data from file  I handeled it as string. What can I
do to get it as integer list.

Apply read:

[Warning untested code ahead]

main :: IO ()
main =
    do
        contents <- readFile "myFileWithNumbers"
        let intList = read contents :: [Int]
        print intList

Arjan