{-# language DuplicateRecordFields, OverloadedRecordDot #-} data A = A { x :: Int } data B = B { x :: Bool } getxa :: A -> Int getxa a = a.x getxb :: B -> Bool getxb b = b.x updatexa :: Int -> A -> A updatexa y a = a { x = y } updatexb :: Bool -> B -> B updatexb y b = b { x = y } main :: IO () main = pure ()