Coercions in pattern synonyms?

data A = A A
newtype B = B A

pattern UnA :: B -> A
pattern UnA x <- A (? x)

How do I fix UnA? The type is the same as the type of UnA, but pattern synonyms can’t be recursive seemingly. I essentially want a coercion as a pattern, but I’m not sure how to do that.
My practical issue is that I have code like the following:

data Fix f = Fix (f (Fix f))

newtype MyNatF a = MyNatF (Either () a)
newtype MyNat = MyNat (Fix MyNatF)

pattern N = MyNat (Fix (MyNatF (Left ())))

pattern S :: MyNat -> MyNat
pattern S x <- MyNat (Fix (MyNatF (Right (? x))))

x is Fix MyNatF, which is coercible to MyNat, but I’m not sure how to fix the pattern synonym.


I completely forgot about the concept of view patterns!