Files is an algebraic data type for primitive file-system operations in a free program. Its operations describe file access without performing it immediately, keeping the program’s effects explicit and inspectable. section 13.5.1
A Files program can provide:
- Different interpreters, including non-blocking, blocking, or pure state-based implementations. section 13.5.1
- A precise effect boundary: Free[Files, A] can access the file system but not the console or network. section 13.5.1
Combining file and console effects
A cat utility reads lines with Files.readLines and prints them with Console.printLn. Because these belong to different algebras, the program must widen both operations into Free[[x] =>> Files[x] | Console[x], Unit] using union.
