Gen 38 where Judah wrongs Tamar contrasts with Gen 39 where Joseph resists Potiphar’s wife.
But Joseph in Gen 39 parallels Tamar of 2 Sam 13.
Only Joseph & Tamar have a ketonet passim “robe with long sleeves”(?) (Gen 37:3; 2 Sam 13:18)
Meanwhile David saw Bathsheba, who was good of appearance & took her (2 Sam 11:2, 4).
The sequence ‘saw ... good ... took’ occurs both for Eve (Gen 3:6) & the Sons of God (Gen 6:1-2).
Narratives like these reveal deep connections showing the depth of human sin & God’s grace.