aboutsummaryrefslogtreecommitdiff
path: root/ch03
diff options
context:
space:
mode:
Diffstat (limited to 'ch03')
-rw-r--r--ch03/3_b_1.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/ch03/3_b_1.hs b/ch03/3_b_1.hs
index 4db9c0c..564b6be 100644
--- a/ch03/3_b_1.hs
+++ b/ch03/3_b_1.hs
@@ -1,6 +1,10 @@
--- Write a function that computes the number of elements in a list. To test it,
--- ensure that it gives the same answers as the standard length function.
+-- 1. Write a function that computes the number of elements in a list. To test
+-- it, ensure that it gives the same answers as the standard length function.
+--
+-- 2. Add a type signature for your function to your source file. To test it,
+-- load the source file into ghci again.
+myLength :: [a] -> Int
myLength (x:xs) = 1 + myLength xs
myLength [] = 0