diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-12-23 12:59:41 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-12-23 13:11:03 +0000 |
commit | b4c3a66872a2b6e64fea9cc1f20ef4c8921ef7b6 (patch) | |
tree | 0ce2f6d44c61e094899ee6ec62f931cdfc9061cf /testsuite/tests/simplCore/should_compile/T13025.hs | |
parent | ee872d32e024a65d0d7fdd55515262f5d4aecb24 (diff) | |
download | haskell-b4c3a66872a2b6e64fea9cc1f20ef4c8921ef7b6.tar.gz |
Push coercions in exprIsConApp_maybe
Trac #13025 showed up the fact that exprIsConApp_maybe isn't
clever enough: it didn't push coercions through applicatins, and that
meant we weren't getting as much superclass selection as we should.
It's easy to fix, happily.
See Note [Push coercions in exprIsConApp_maybe]
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)) |