aboutsummaryrefslogtreecommitdiff
path: root/ch01
diff options
context:
space:
mode:
Diffstat (limited to 'ch01')
-rw-r--r--ch01/1_a_4.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/ch01/1_a_4.hs b/ch01/1_a_4.hs
new file mode 100644
index 0000000..3d5afb4
--- /dev/null
+++ b/ch01/1_a_4.hs
@@ -0,0 +1,5 @@
+-- Modify the WC.hs example again, to print the number of characters in a file.
+
+-- Type of 'input' is String. Its length is the number of characters.
+main = interact wordCount
+ where wordCount input = show (length input) ++ "\n"