[commit: ghc] master: Test Trac #9569 (230b013)

git at git.haskell.org git at git.haskell.org
Fri Nov 21 13:03:22 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/230b013b654508f77c5d8cec9d4de9b7c86e1370/ghc

>---------------------------------------------------------------

commit 230b013b654508f77c5d8cec9d4de9b7c86e1370
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Nov 21 11:22:52 2014 +0000

    Test Trac #9569


>---------------------------------------------------------------

230b013b654508f77c5d8cec9d4de9b7c86e1370
 testsuite/tests/polykinds/T9569.hs                 | 25 ++++++++++++++++++++++
 testsuite/tests/polykinds/all.T                    |  1 +
 testsuite/tests/typecheck/should_compile/T9569a.hs | 11 ++++++++++
 testsuite/tests/typecheck/should_compile/all.T     |  1 +
 4 files changed, 38 insertions(+)

diff --git a/testsuite/tests/polykinds/T9569.hs b/testsuite/tests/polykinds/T9569.hs
new file mode 100644
index 0000000..012d61f
--- /dev/null
+++ b/testsuite/tests/polykinds/T9569.hs
@@ -0,0 +1,25 @@
+{-# LANGUAGE RankNTypes, ConstraintKinds, KindSignatures, DataKinds, TypeFamilies #-}
+module T9569 where
+
+import GHC.Prim
+
+data Proxy (c :: Constraint)
+
+class Deferrable (c :: Constraint) where
+  defer :: Proxy c -> (c => a) -> a
+
+deferPair :: (Deferrable c1, Deferrable c2) =>
+                  Proxy (c1,c2) -> ((c1,c2) => a) -> a
+deferPair = undefined
+
+instance (Deferrable c1, Deferrable c2) => Deferrable (c1,c2) where
+    -- defer p f = deferPair p f     -- Succeeds
+    defer = deferPair                -- Fails
+
+{-
+  [G] Deferrable c1, Deferrable c2
+
+  [W] Proxy (c1,c2) -> ((c1,c2) => a) -> a ~ Proxy (c1x,c2x) -> ((c1x,c2x) => ax) -> ax
+  [w] Deferrable c1x
+  [w] Deferrable c2x
+-}
\ No newline at end of file
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index 74718ab..e8e30c0 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -109,3 +109,4 @@ test('T9063', normal, compile, [''])
 test('T9200', normal, compile, [''])
 test('T9200b', normal, compile_fail, [''])
 test('T9750', normal, compile, [''])
+test('T9569', normal, compile, [''])
diff --git a/testsuite/tests/typecheck/should_compile/T9569a.hs b/testsuite/tests/typecheck/should_compile/T9569a.hs
new file mode 100644
index 0000000..3205cb1
--- /dev/null
+++ b/testsuite/tests/typecheck/should_compile/T9569a.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE RankNTypes #-}
+module T9569a where
+
+g :: (Int -> Int) -> Int
+g f = f 4
+
+f1 :: (forall a. a -> a) -> Int
+f1 = g
+
+f2 :: (forall a. a -> a) -> Int
+f2 x = g x
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index ea7d343..7e825d9 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -419,6 +419,7 @@ test('T8644', normal, compile, [''])
 test('T8762', normal, compile, [''])
 test('MutRec', normal, compile, [''])
 test('T8856', normal, compile, [''])
+test('T9569a', normal, compile, [''])
 test('T9117', normal, compile, [''])
 test('T9117_2', expect_broken('9117'), compile, [''])
 test('T9708', normal, compile_fail, [''])



More information about the ghc-commits mailing list