
20 Oct
2014
20 Oct
'14
5:02 a.m.
Hello Cafe, I have these datatypes data Event = E1 {...} | E2 {...} | E3 {...} data Parsed = PEvent Event | PLine Text | PHeader Text I'd like to split the list of Parsed values into separate lists with a guaranty that each of those lists contains only the elements of the same type, as in [PEvent E1] [PEvent E2] [PLine Text] ... How can that be achieved on type level (without creating newtypes for each case)? I tried with type families, but failed. Also, an explanation of why the Event above (or "data Q = Q1 | Q2 String") is not promotable to kind level would be welcome. best regards, vlatko