AFAIK, there's currently no possibility to use DefaultSignatures
with type families.
I can see two options to do what you want. Both have certain disadvantages, but perhaps they're sufficient for your purposes.
Option 1: Use normal associated type default definitions
class Foo p where
type Back p :: *
type Back p = UnBar p
type Forward p :: *
type Forward p = ForwardBar (UnBar p)
customFunc :: p -> IO ()
Requires a helper type family UnBar
:
type family UnBar a :: *
type instance UnBar (Bar a) = a
The instance can then be just:
instance Foo (Bar Bat) where
customFunc _ = print "I am different customFunc and this is Bat Bat"
Option 2: Use type families instead
class Foo p where
customFunc :: p -> IO ()
type family Back p :: *
type family Forward p :: *
Now we can give a general instance for the type families for all Bar
types:
type instance Back (Bar a) = a
type instance Forward (Bar a) = ForwardBar a
And more specific instances for the class, for concrete Bar
types:
instance Foo (Bar Bat) where
customFunc _ = print "I am different customFunc and this is Bat Bat"