I have 3 types : Task (a unit of work), Estimate (a time period) and User.
In my app, I'd like to "decorate" my Tasks to make EstimedTask (that could be sum-ed), AssignedTask (to be sorted) and AssignedEstimatedTask (that are both and on which I can apply a Gantt algorithm)
My first try is to implement them with tuples :
EstimatedTask :: (Task, Estimate)
AssignedTask :: (Task, User)
AssignedEstimatedTask :: (Task, Estimate, User)
but then if I want to construct an AET I have to define 3 constructors
T -> E -> U -> AET
(T, E) -> U -> AET
(T, U) -> E -> AET
As I intend to decorate even more, I'm afraid the number of constructor will explode.
Is there a smart way to do that ?
In particular, is there a prefered method to make sub-constructor commutative (such that assign . estimate $ task == estimate . assign $ task ?