summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-02-08 16:55:16 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-09 03:58:53 -0500
commit009759811abb96c8d9a16126ef5c7bdea44a65d0 (patch)
tree93289e647bb93f0bdf543f7486373909f4475799 /testsuite/tests
parentfd9981e347144ce69f4747bd635789f25b673f93 (diff)
downloadhaskell-009759811abb96c8d9a16126ef5c7bdea44a65d0.tar.gz
Add test for #21037
This program was rejected by GHC 9.2, but is accepted on newer versions of GHC. This patch adds a regression test. Closes #21037
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/quantified-constraints/T21037.hs24
-rw-r--r--testsuite/tests/quantified-constraints/all.T1
2 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/quantified-constraints/T21037.hs b/testsuite/tests/quantified-constraints/T21037.hs
new file mode 100644
index 0000000000..8fa4a6ca09
--- /dev/null
+++ b/testsuite/tests/quantified-constraints/T21037.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE QuantifiedConstraints #-}
+
+module T21037 where
+
+type f ~> g = forall x. f x -> g x
+
+class (forall f. Functor f => Functor (h f)) => HFunctor h where
+ hmap :: (f ~> g) -> (h f ~> h g)
+
+class (forall m. Monad m => Monad (h m), HFunctor h) => HMonad h where
+ hreturn :: Monad m => m ~> h m
+ hdnib :: (Monad m, Monad n) => (m ~> h n) -> h m ~> h n
+
+bar :: (HMonad h, Monad f) => (Functor (h f) => c) -> c
+bar x = x
+
+baz ::
+ ( forall m. Monad m => Monad (h m),
+ forall f. Functor f => Functor (h f),
+ Monad f
+ ) =>
+ (Functor (h f) => c) ->
+ c
+baz x = x
diff --git a/testsuite/tests/quantified-constraints/all.T b/testsuite/tests/quantified-constraints/all.T
index d055adc848..00d66e55a8 100644
--- a/testsuite/tests/quantified-constraints/all.T
+++ b/testsuite/tests/quantified-constraints/all.T
@@ -33,3 +33,4 @@ test('T18432', normal, compile, [''])
test('T19921', normal, compile_fail, [''])
test('T16474', normal, compile_fail, [''])
test('T21006', normal, compile_fail, [''])
+test('T21037', normal, compile, [''])