I\'ll just say I\'m not even sure if this is possible; it is by far the most generic thing I\'ve tried doing in Haskell. I\'m trying to make a more generic version of the
I can't be sure this will fix everything, because it's very hard to reproduce your problem: it requires a lot of packages and imports that I just don't have the time to set up (hint: in the future, try to reduce your problems to minimal reproducible examples before posting). But I'm going to post this anyway, because I can see at least one problem, and it seems to be related to the error message.
The problem is that t on the first line is not the same as t on the third line, and they are both different from the t on the fifth line. And so on, for all type signatures involving t.
By default, in Haskell2010 every type variable's scope is only the type signature in which it's introduced. If you use the same letter in another type signature, it will signify a completely separate type, despite looking identical to the human eye.
To specify that you actually mean t to be the same everywhere, you have to use forall in the top type signature:
applyRecFun :: forall t. (Traversable t, _) => Record (SummaryFun t) _ -> t r -> r
Enabled by the ScopedTypeVariables extension, the forall keyword creates an explicit scope for the type variable t. Scopes come in different flavors, but when opened in a function's type signature, the scope's extent is the whole body of that function.
I'm not sure this will solve everything for you, but at least you should be getting different errors now.