summaryrefslogtreecommitdiff
path: root/lec08/Party.hs
diff options
context:
space:
mode:
authorEdoardo La Greca2025-09-25 21:01:31 +0200
committerEdoardo La Greca2025-09-25 21:01:31 +0200
commit3f68acafbaf6c5d8c5d340fd85a72db186140fa1 (patch)
tree5fa780169508ac62c26fbbd529bf3089cec9ce91 /lec08/Party.hs
parentda7e9491af30554f4c0cef4efca2db75bc0281af (diff)
add second exercise of lecture 8
Diffstat (limited to 'lec08/Party.hs')
-rw-r--r--lec08/Party.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/lec08/Party.hs b/lec08/Party.hs
index fe60fe8..05b5e0e 100644
--- a/lec08/Party.hs
+++ b/lec08/Party.hs
@@ -1,6 +1,7 @@
module Party where
import Employee
+import Data.Tree
-- Exercise 1
@@ -18,3 +19,8 @@ moreFun :: GuestList -> GuestList -> GuestList
moreFun gl1@(GL _ f1) gl2@(GL _ f2)
| f1 >= f2 = gl1
| otherwise = gl2
+
+-- Exercise 2
+
+treeFold :: (a -> [b] -> b) -> Tree a -> b
+treeFold f (Node l subs) = f l $ map (\t -> treeFold f t) subs