From 3f68acafbaf6c5d8c5d340fd85a72db186140fa1 Mon Sep 17 00:00:00 2001 From: Edoardo La Greca Date: Thu, 25 Sep 2025 21:01:31 +0200 Subject: add second exercise of lecture 8 --- lec08/Party.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lec08/Party.hs') 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 -- cgit v1.2.3