diff options
Diffstat (limited to 'testsuite/tests/deSugar/should_run/dsrun015.hs')
-rw-r--r-- | testsuite/tests/deSugar/should_run/dsrun015.hs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/deSugar/should_run/dsrun015.hs b/testsuite/tests/deSugar/should_run/dsrun015.hs new file mode 100644 index 0000000000..da5e443605 --- /dev/null +++ b/testsuite/tests/deSugar/should_run/dsrun015.hs @@ -0,0 +1,34 @@ +{-# OPTIONS_GHC -XRecordWildCards -XNamedFieldPuns #-} + +-- This is a very partial test of the record-wildcard extension +-- but better than nothing + +module Main where + +data T = C { x :: Int, y :: Int } + | D { x :: Int, b :: Bool } + +select :: T -> Int +select = x + +f :: (T,T) -> Int +f v = let (C {..}, d) = v in Main.x d + +mkC a = + let x = a + 1 + y = a * 2 + in C{..} + +sumC C{..} = x + y + +foo x b = + let y = x+1 + in (C{..}, let x = 100 in D{..}) + +bar a = + let (C{..}, d) = a + in (x + y + Main.x d, let D{..} = d in b) + +main = do + print $ sumC $ mkC 10 + print $ bar $ foo 5 True |