Dear all,

Supposing that I have a FlowObject datatype such as:

data FlowObject = Activity { ...  }  | Start | End | Proceed | ...

I could make "open" this datatype by refactoring this definition through a type class + one datatype for each kind of FlowObject. Such as:

data Activity = Activity { ... }
data Start = Start
...

class FlowObject a

instance FlowObject Activity
instance FlowObject Start
....


Although the second approach opens the FlowObject datatype, it does not resemble a grammar anymore. So:

- Is there any other idiom that opens a datatype keeping its similarities with grammars?
- Does exist any idiom that allows a developer to introduce new fields into an existing datatype?

Thanks in advance,

Rodrigo.