How can I programatically produce this datatype from the other?
问题 I'd like to use DSum for something. To work with DSum , you need to have a 'tag' type which takes one type argument, e.g. data Tag a where AFirst :: Tag Int ASecond :: Tag String However, I'd like to use this internally in a library. I want the interface that I expose to users to take any old datatype, e.g. data SomeUserType1 = Foo Int | Bar String it's clearly quite mechanical to go from this to the Tag a type given above. So, is it possible to do this in code, with some sort of generic