[Haskell-cafe] Deriving type family data

Tuve Nordius tuve at student.chalmers.se
Tue Apr 28 11:07:36 EDT 2009


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 
  


More information about the Haskell-Cafe mailing list