module Homework08.Employee where

import           Data.Tree

-- Employee names are represented by Strings.
type Name = String

-- The amount of fun an employee would have at the party, represented
  by an Integer
type Fun  = Integer

-- An Employee consists of a name and a fun score.
data Employee = Emp { empName :: Name, empFun :: Fun }
  deriving (Show, Read, Eq)

-- A small company hierarchy to use for testing purposes.
testCompany :: Tree Employee
testCompany
  = Node (Emp "Stan" 9)
    [ Node (Emp "Bob" 2)
      [ Node (Emp "Joe" 5)
        [ Node (Emp "John" 1) []
        , Node (Emp "Sue" 5) []
        ]
      , Node (Emp "Fred" 3) []
      ]
    , Node (Emp "Sarah" 17)
      [ Node (Emp "Sam" 4) []
      ]
    ]

testCompany2 :: Tree Employee
testCompany2
  = Node (Emp "Stan" 9)
  ( 8 , 8)
  ( 5 , 6 )
  ( 1 , 0 )
  ( 5 , 0 )
        ]
  ( 3 , 0 )
      ]
  ( 17 , 4 )
  ( 4 , 0 )
      ]
    ]

-- A type to store a list of guests and their total fun score.
data GuestList = GL [Employee] Fun
  deriving (Show, Eq)

instance Ord GuestList where
  compare (GL _ f1) (GL _ f2) = compare f1 f2

 Employee names are represented by Strings.
 The amount of fun an employee would have at the party, represented
 An Employee consists of a name and a fun score.
 A small company hierarchy to use for testing purposes.
 A type to store a list of guests and their total fun score.
module Homework08.Employee where

import           Data.Tree

type Name = String

  by an Integer
type Fun  = Integer

data Employee = Emp { empName :: Name, empFun :: Fun }
  deriving (Show, Read, Eq)

testCompany :: Tree Employee
testCompany
  = Node (Emp "Stan" 9)
    [ Node (Emp "Bob" 2)
      [ Node (Emp "Joe" 5)
        [ Node (Emp "John" 1) []
        , Node (Emp "Sue" 5) []
        ]
      , Node (Emp "Fred" 3) []
      ]
    , Node (Emp "Sarah" 17)
      [ Node (Emp "Sam" 4) []
      ]
    ]

testCompany2 :: Tree Employee
testCompany2
  = Node (Emp "Stan" 9)
  ( 8 , 8)
  ( 5 , 6 )
  ( 1 , 0 )
  ( 5 , 0 )
        ]
  ( 3 , 0 )
      ]
  ( 17 , 4 )
  ( 4 , 0 )
      ]
    ]

data GuestList = GL [Employee] Fun
  deriving (Show, Eq)

instance Ord GuestList where
  compare (GL _ f1) (GL _ f2) = compare f1 f2
