I’ve made this data type, which has a lot of repetition in it.
data JobState = UnsanitizedData Handle
| SanitizedData Handle
| VerifiedData Handle
| JobFail Handle
I don’t want any of these JobStates to ever be used without Handle. But the repetition has me suspecting I’m not expressing this correctly. Is there a better way?
One way would be to factor this out into a state value, and a wrapper that includes the handle: