we could use pattern matched constructor: module PairsMatched where data MyP t = MyP (t,t)(t,t) deriving Show myP_ctor:: Eq t => (t,t)->(t,t)->MyP t myP_ctor (a1,a2) (a3,a4) | a1 == a4 && a2 == a3 = MyP (a1,a2) (a3,a4) | otherwise = error "mismatched pairs"