I don't know persistent
well, but that type error occurs because you're combining functions in such a way that a value gets produced an consumed without being inspected. For instance, if you had functions f :: a -> (Int, c)
and g :: (Int, c) -> b
then g . f
feels like it ought to have the type a -> b
, but it's actually an error because GHC has no idea what c
should have been.
The way to solve it is to inspect that (Int, c)
value in such a way that c
can be resolved to a particular type. This is often done with manual type annotations or by using asTypeOf
.