summaryrefslogtreecommitdiff
path: root/61-69/61.hs
diff options
context:
space:
mode:
Diffstat (limited to '61-69/61.hs')
-rw-r--r--61-69/61.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/61-69/61.hs b/61-69/61.hs
new file mode 100644
index 0000000..50bacae
--- /dev/null
+++ b/61-69/61.hs
@@ -0,0 +1,7 @@
+data Tree a = Empty | Branch a (Tree a) (Tree a) deriving (Show, Eq)
+
+countLeaves :: Tree a -> Int
+
+countLeaves Empty = 0
+countLeaves (Branch _ Empty Empty) = 1
+countLeaves (Branch _ l r) = countLeaves l + countLeaves r