
17 Oct
2017
17 Oct
'17
8:25 a.m.
On 10/16/2017 02:56 PM, Li-yao Xia wrote:
Would refactoring the type like this work for you?
data GADT a where G :: HasDict a => Tag -> a -> GADT a
data Tag = Tag1 | ... | Tagn
withGADTDict :: ... withGADTDict body x = x & case x of G _ _ -> body
Li, thank you for your reply! I've needed the GADT clauses for their different structure, so I've had to add a layer of structural indirection to a plain ADT. But the spirit of your suggestion (to reduce the dict-providing GADT to a single clause) was all the same. -- с уважениeм / respectfully, Kosyrev Serge PGP Key ID: 3F62F118E38BED6D -- “Most deadly errors arise from obsolete assumptions.” -- Frank Herbert, Children of Dune