summaryrefslogtreecommitdiff
path: root/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail01.hs
blob: 0087237d9d3bff3896997f61eebf4b0752b0f13d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{-# LANGUAGE OverloadedRecordFields #-}

data R = MkR { w :: Bool, x :: Int, y :: Bool }
data S = MkS { w :: Bool, x :: Int, y :: Bool }
data T = MkT { x :: Int, z :: Bool }
data U = MkU { y :: Bool }

-- Straightforward ambiguous update
upd1 r = r { x = 3 }

-- No type has all these fields
upd2 r = r { x = 3, y = True, z = False }

-- User-specified type does not have these fields
upd3 r = r { w = True, x = 3, y = True } :: U

main = return ()