Consider this example (from https://codereview.stackexchange.com/questions/23456/crtitique-my-haskell-function-capitalize):
import Data.Char
capWord [] = []
cap
Your lifted
is actually the same as dimap
from Data.Profunctor:
onWords = dimap words unwords
capitalize = onWords (map capWord)
That might not be the direction of generalization you thought about. But look at the type of the equivalent function in Control.Functor from category-extras
:
dimap :: Bifunctor f (Dual k) k k => k b a -> k c d -> k (f a c) (f b d)
This version generalizes it over everything which is both a QFunctor
and a co-PFunctor
. Not that useful in everyday scenarios, but interesting.