Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.
Is there an easy way to get at the isomorphism between some type Either A (Either B (Either C ...)) and some type data Foo = X A | Y B | Z C | ...?
Either A (Either B (Either C ...))
data Foo = X A | Y B | Z C | ...
perhaps using something built on top of GHC.Generics?
maybe to . coerce . from
to . coerce . from
well it'd work with the 2 case
need to apply the froms and tos recursively
@Sandy Maguire That doesn't seem to work. It complains it can't unify the representation of Either with that of the sum type
the recursive part is what's giving me a hard time, I don't want to manually call to and coerce and so on repeatedly
do any of the variant libraries provide isomorphisms with regular sum types?
Oh that's a similar to my problem.. did you looked it up? Does a similar approach helps?
check out generics-sop