Lesson 24. Working with files
After reading lesson 24, you’ll be able to
- Work with file handles in Haskell
- Read from and write to files
- Understand limitations of lazy evaluation for I/O
One of the most important uses of I/O is to read and write from files. So far in this unit, you’ve learned a bit of the syntax behind IO types in Haskell, saw how to build command-line programs using lazy evaluation, and learned about efficient text processing by using the Text type. Now you’ll look at working with files, including how they can make using lazy I/O a bit tricky. You’ll start with the basics of opening, closing, reading from, and writing to simple files. Then you’ll write a program that takes various statistics from an input file (including ...