aboutsummaryrefslogtreecommitdiff
path: root/ch01/1_a_4.hs
diff options
context:
space:
mode:
authorJan Sucan <jan@jansucan.com>2023-03-07 18:00:16 +0100
committerJan Sucan <jan@jansucan.com>2023-03-07 18:00:16 +0100
commit2eeccee06144314ed4a0ed579fb893aa2f322982 (patch)
treec111daa5a52a5aa219c809f6d63b7f3d48c1cd51 /ch01/1_a_4.hs
parent12a4dee6abb12b27f6921662fd3000421c47a127 (diff)
1_a_4: Add solution
Diffstat (limited to 'ch01/1_a_4.hs')
-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"