Is it possible to create type family instances from a fundep class? For example, let's say that I have the class
class A a b | a -> b
with some instances (imported an external library) and want to create all corresponding instances for the type family
type family A' a :: *
such that A' a ~ b
iff A a b
, without having to manually copy and modify the instances from the external source.
How would I do that (if it is possible)?
My most promising attempt so far,
class A' a where
type A'_b a :: *
instance forall a b. A a b => A' a where
type A'_b a = b
gives the error message
The RHS of an associated type declaration mentions ‘b’
All such variables must be bound on the LHS
So, my guess is that the answer is no? :/