{-# LANGUAGE PatternSynonyms #-} data F = F [Int] [Int] -- a bidirectional pattern synonym -- which -- * when used to match: returns concatenation of constructor parameter -- * when used to construct: sets the list to the first constructor parameter pattern F' = undefined foo :: IO () foo = do let f = F [1,2,3] [4,5,6] f' = F' [7,8,9] F' x1 = f F' x2 = f' -- prints [1,2,3,4,5,6 print x1 -- prints [7,8,9] print x2