summaryrefslogtreecommitdiffstats
path: root/ch03_localfunction.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ch03_localfunction.hs')
-rw-r--r--ch03_localfunction.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/ch03_localfunction.hs b/ch03_localfunction.hs
new file mode 100644
index 0000000..61ecc25
--- /dev/null
+++ b/ch03_localfunction.hs
@@ -0,0 +1,5 @@
+pluralise :: String -> Int -> String
+pluralise word counts = plural counts
+ where plural 0 = "no " ++ word ++ "s"
+ plural 1 = "one " ++ word
+ plural n = show n ++ " " ++ word ++ "s"