28 Apr 17:07
Deriving type family data
Tuve Nordius <tuve <at> student.chalmers.se>
2009-04-28 15:07:36 GMT
2009-04-28 15:07:36 GMT
If I for some data type wants to derive, in this case Data and Typeable for use with syb code, but the problem is the same regardless what I want to derive. data family Something data Tree = Leaf Something | Fork Something Tree Tree deriving (Data, Typeable) The problem is I want to derive a class for a data type that depends on some non instantiated data type. I can of course rewrite Tree as: data (Data a) => Tree a = Leaf a | Fork a Tree Tree deriving (Data, Typeable) but then data family Something is redundant, I want to think of Something as a not yet instantiated abstract data type Is there anyway to express that either the instance of Something used in Tree should be a member of Data, or even better any instance of Something should be a member of Data or maybe even better that every instance should derive data. data family Something deriving Data //Tuve Nordius
RSS Feed