]> git.rkrishnan.org Git - yorgey.git/blobdiff - hw8/Party.hs
exercise 4
[yorgey.git] / hw8 / Party.hs
index d303b01f3296c99d6ea4933b020437cb0c5c2e42..3bc5e1b448b84b399c4101b26305152637f6c197 100644 (file)
@@ -51,3 +51,12 @@ nextLevel e lst =
         withoutBoss = mconcat $ map (uncurry moreFun) lst
     in
       (withBoss, withoutBoss)
+
+-- exercise 4
+-- maxFun
+maxFun :: Tree Employee -> GuestList
+maxFun = uncurry moreFun . maxFunPair
+
+maxFunPair :: Tree Employee -> (GuestList, GuestList)
+maxFunPair (Node e es) = nextLevel e $ map maxFunPair es
+