I think this is a pretty clever idea. Yes, we have to carry the type
parameter through everywhere, or use an existential to hide it, but I
guess that is the price to pay and it is not too high. So a clear +1
from me.
At first I was a bit confused about WrappedCommand vs. CommandControl.
The former wraps a DarcsCommand, the latter also distinguishes between
normal commands, hidden commands, and so on. They are both GADTs now. As
an alternative, have you considered pushing the existential wrapping
down into the alternatives:
data CommandControl
= CommandData WrappedCommand
| HiddenCommand WrappedCommand
| GroupName String CommandControl
This means we have to wrap them in the super command implementations
(but that could be done with a small helper function) and would avoid
having to unwrap and re-wrap them for some operations in Commands.hs.
BTW, can we find a better name for CommandControl and its data constructors?
|