
Is it possible to delete an element from heterogenous list using type families alone? I can do it using multiparameter type classes: class Del a list result instance Del a (a,list) list instance Del a list list' => Del a (a',list) list' instance Del a () () I tried to express the same using type families: type family Del a list type instance Del a () = () type instance Del a (a,list) = list type instance Del a (a',list) = (a',Del a list) to no avail. I got "conflicting family instance declarations" error. I tried to express that with associated type synonyms that contains both multiparameter type classes and type families: class HDel a list where type Del a list instance HDel a () where type Del a () = () instance HDel a (a,list) where type Del a (a,list) = list instance HDel a list => HDel a (a',list) where type Del a (a',list) = (a',Del a list) And I once again got "conflicting family instance declaration". It looks like right now there is no way to express type equality or inequality with type families, even when they are combined with multiparameter type classes. What is the right way to express something like that? Only MPTC?
participants (1)
-
Serguey Zefirov