Heat pump water heaters already exist. These are hybrid things where a traditional electric water heater is fitted with a heat pump. The heat pump can increase the water temp but cannot deliver enough, so heating elements are still needed to reach a usable temp.
I’m wondering if that design can be improved on this way: instead of powering the heat pump from the wall, the heat pump can be connected directly to a PV. I think that would be more efficient and cheaper because PV output is not normally directly usable. IIUC, it’s variable D/C which must be regulated and/or inverted to A/C involving more hardware, conversion, and waste. But exceptionally, I’ve heard that a PV can directly power a compressor with no middleware. Any reasons this would be infeasible or uninteresting?
Of course the tank still needs wall power for the heating elements, but would use less wall power and entail less conversion loss.
Actually, I had a discussion about this with someone who really knows this stuff recently, and we figured that the inversion process isn't actually that inefficient. The efficiencies achieved are often >95%, so there isn't actually a lot of loss.