I am new to Haskell, so I am trying to figure out how to do tree traversals.
Here is the Company example (with a slight change) that I have seen in several papers
data Company = C [Dept] deriving (Eq, Show, Typeable, Data)
data Dept = D Name Manager [Unit] deriving (Eq, Show, Typeable, Data)
data ThinkTank= TK Name [Unit] deriving (Eq, Show, Typeable, Data)
data Unit = PU Employee | DU Dept deriving (Eq, Show, Typeable, Data)
data Employee = E Person Salary deriving (Eq, Show, Typeable, Data)
data Person = P Name Address deriving (Eq, Show, Typeable, Data)
data Salary = S Float deriving (Eq, Show, Typeable, Data)
type Manager = Employee
type Name = String
type Address = String
What I would like to do is move a Employee from where he is to a particular department. This person could be in a Department or a ThinkTank.
It seems easy to do things in SYB as long as you are doing one type, but I am not sure how to deal with multiple data types.