[Haskell-cafe] file i/o

Robert Heffernan bob.heffernan at gmail.com
Tue Jan 3 06:27:23 EST 2006


Hi,

I am relatively new to Haskell and am finding i/o difficult to work
with.  I am trying to do something like the following:

I have a file of data, each line of which looks like this:
<STRING>,  INTEGER SEQUENCE
for example:
FOO ,2,1,4,3,6,7,5,9,10,11,8,13,12,

I would like to write a function the reads this file and returns
arrays like this:
["FOO",[2,1,4,3,6,7,5,9,10,11,8,13,12]]

Ideally, the function would return the first line when initially
called, the second the next time it is called and so on.  I would
settle for something that returned a big array comprising arrays of
the above type containing all the information in the file.  The file
is big, however.

I can not figure out how to do this from any of the tutorials so I
thought I might ask here.

Thank you for your help,
Robert.


More information about the Haskell-Cafe mailing list