With ScopedTypeVariables
extension, you can add a type annotation to g
and introduce type variable a
to the scope.
f (T (x_shared:xs) (g :: a -> a -> Int)) = go xs 0
Then you can write a type signature for go
with a
.
go :: [a] -> Int -> Int