[Haskell-cafe] beginner question - file handling

Neil Mitchell ndmitchell at gmail.com
Sun Mar 5 14:53:13 EST 2006


do x <- readFile "test.txt"
     print (length (lines x))

That prints out the number of lines in a file, but once you have done
lines x, you can do anything you want to the lines



On 3/5/06, Richard Gooding <rich_gooding at yahoo.com> wrote:
> Hi,
> can someone please point me at some code to read in the lines for a file - a working example ?
> I've have checked the tutorials on the wiki (some broken links) but couldn't find anything. - and my "The craft of functiional programming" doesn't have an example either !
> thanks
> Rich
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list