I'm new to Haskell, so I'm trying to figure out how to do tree walks.
Here is an example of a company (with a slight change) that I saw in several documents
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 to move the employee from the place where he is in a certain department. This person may be in the department or at ThinkTank.
This seems to be easy to do in SYB as long as you make one type, but I'm not sure how to handle multiple data types.
haskell traversal tree
Chris
source share