Reiner Pope
2012-03-13 23:27:18 UTC
Hi all,
Is this the right approach to take to handle generics for data families? Are there alternative approaches?
On the Trac ticket linked above, Pedro suggested we discuss these questions here.
Regards,
Reiner
data family D a
data instance D Int = DInt deriving Generic
data instance D Bool = DBool deriving Generic
type instance Rep (D Int) = D1 DIntInfo_D (C1 DIntInfo_C U1)
type instance Rep (D Bool) = D1 DBoolInfo_D (C1 DBoolInfo_C U1)
instance Generic (D Int) where ...
instance Generic (D Bool) where ...
Note in particular that D Int and D Bool are considered completely distinct types as far as generics are concerned.data instance D Int = DInt deriving Generic
data instance D Bool = DBool deriving Generic
type instance Rep (D Int) = D1 DIntInfo_D (C1 DIntInfo_C U1)
type instance Rep (D Bool) = D1 DBoolInfo_D (C1 DBoolInfo_C U1)
instance Generic (D Int) where ...
instance Generic (D Bool) where ...
Is this the right approach to take to handle generics for data families? Are there alternative approaches?
On the Trac ticket linked above, Pedro suggested we discuss these questions here.
Regards,
Reiner