5 -- Employee names are represented by Strings.
8 -- The amount of fun an employee would have at the party, represented
12 -- An Employee consists of a name and a fun score.
13 data Employee = Emp { empName :: Name, empFun :: Fun }
14 deriving (Show, Read, Eq)
16 -- A small company hierarchy to use for testing purposes.
17 testCompany :: Tree Employee
22 [ Node (Emp "John" 1) []
23 , Node (Emp "Sue" 5) []
25 , Node (Emp "Fred" 3) []
27 , Node (Emp "Sarah" 17)
28 [ Node (Emp "Sam" 4) []
32 testCompany2 :: Tree Employee
35 [ Node (Emp "Bob" 3) -- (8, 8)
36 [ Node (Emp "Joe" 5) -- (5, 6)
37 [ Node (Emp "John" 1) [] -- (1, 0)
38 , Node (Emp "Sue" 5) [] -- (5, 0)
40 , Node (Emp "Fred" 3) [] -- (3, 0)
42 , Node (Emp "Sarah" 17) -- (17, 4)
43 [ Node (Emp "Sam" 4) [] -- (4, 0)
47 -- A type to store a list of guests and their total fun score.
48 data GuestList = GL [Employee] Fun
51 instance Ord GuestList where
52 compare (GL _ f1) (GL _ f2) = compare f1 f2