I'll add that Gautier's Prod has an inverse. When it's included, ghc can infer the types of x in these expressions:
\x -> (Foo x :: Foo Int a)
\x -> (Foo x :: Foo String a)
as String and Maybe String respectively. Prod was unchanged, but the rest becomes:
type family ProdInv a where
ProdInv Int = String
ProdInv a = Maybe a
data Foo e a where
Foo :: e ~ ProdInv (Prod e)
=> e -> Foo (Prod e) a
I also thought about using a data family instead of a pair of type families. But then you still have two constructors.
`class ProdFD e pe | e -> pe, pe -> e` can't work:
1. FDs don't provide coercions like TFs
2. the two ProdFD instances are rejected -- they overlap/violate FDs