[Haskell-cafe] Limit elements of a list to a certain value
Vlatko Basic
vlatko.basic at gmail.com
Mon Oct 20 09:02:17 UTC 2014
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
More information about the Haskell-Cafe
mailing list