diff options
Diffstat (limited to 'testsuite/tests/simplCore/should_compile/T13025.hs')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T13025.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T13025.hs b/testsuite/tests/simplCore/should_compile/T13025.hs new file mode 100644 index 0000000000..01facb8601 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13025.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE DataKinds #-} +module T13025 where +import T13025a + +type MyRec = Rec '[ '("A",Int), '("B",Int), '("C",Int) ] + +getC :: MyRec -> Int +getC = getField (Proxy::Proxy '("C",Int)) + +doubleC :: MyRec -> MyRec +doubleC r = setC (2 * (getC r)) r + where setC = set . (Field :: Int -> Field '("C",Int)) + +main :: IO () +main = print (getC (Field 1 :& Field 2 :& Field 3 :& Nil :: MyRec)) |