From d678bfd90f483ca9d000c267ee9f883de89feeaf Mon Sep 17 00:00:00 2001 From: Jan Sucan Date: Sun, 18 Jun 2023 18:06:19 +0200 Subject: 8_b_2: Add solution --- ch08/8_b_2.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ch08/8_b_2.txt (limited to 'ch08/8_b_2.txt') diff --git a/ch08/8_b_2.txt b/ch08/8_b_2.txt new file mode 100644 index 0000000..6af6518 --- /dev/null +++ b/ch08/8_b_2.txt @@ -0,0 +1,19 @@ +-- If you're on a Unix-like system, look through the documentation for the +-- System.Posix.Files module, and see if you can find a replacement for the +-- doesNameExist function. + +-- The replacement is the fileExist function that checks for existence of both +-- regular file and directories. + +ghci> :module + System.Posix.Files + +ghci> fileExist "nonexistent_file" +False + +-- Regular file +ghci> fileExist "8_b_2.txt" +True + +-- Directory +ghci> fileExist "../ch08/" +True -- cgit v1.2.3