From 1f630025d457807c4a9da513e4a0823e4643b2a6 Mon Sep 17 00:00:00 2001 From: Krzysztof Gogolewski Date: Thu, 16 Jan 2020 20:03:27 +0100 Subject: Add a test for #15712 --- testsuite/tests/typecheck/should_fail/T15712.hs | 18 ++++++++++++++++++ testsuite/tests/typecheck/should_fail/T15712.stderr | 6 ++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 3 files changed, 25 insertions(+) create mode 100644 testsuite/tests/typecheck/should_fail/T15712.hs create mode 100644 testsuite/tests/typecheck/should_fail/T15712.stderr diff --git a/testsuite/tests/typecheck/should_fail/T15712.hs b/testsuite/tests/typecheck/should_fail/T15712.hs new file mode 100644 index 0000000000..a0b1d5f975 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T15712.hs @@ -0,0 +1,18 @@ +{-# Language RankNTypes #-} +{-# Language DerivingVia #-} +{-# Language DeriveFunctor #-} + +-- import Control.Monad.Codensity +import Data.Kind + +newtype Codensity f a = Codensity (forall xx. (a -> f xx) -> f xx) + deriving + (Functor) + +newtype GEndo m a = GEndo (m a -> m a) + +newtype LogicT m a = LogicT (forall xx. (a -> (m xx -> m xx)) -> (m xx -> m xx)) + deriving + (Functor) + via + (Codensity GEndo) diff --git a/testsuite/tests/typecheck/should_fail/T15712.stderr b/testsuite/tests/typecheck/should_fail/T15712.stderr new file mode 100644 index 0000000000..e8b5d397de --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T15712.stderr @@ -0,0 +1,6 @@ + +T15712.hs:18:16: error: + • Expecting one more argument to ‘GEndo’ + Expected kind ‘* -> *’, but ‘GEndo’ has kind ‘(* -> *) -> * -> *’ + • In the first argument of ‘Codensity’, namely ‘GEndo’ + In the newtype declaration for ‘LogicT’ diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 156042cab1..e2496562e1 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -493,6 +493,7 @@ test('T15592a', normal, compile_fail, ['']) test('T15629', normal, compile_fail, ['']) test('T15767', normal, compile_fail, ['']) test('T15648', [extra_files(['T15648a.hs'])], multimod_compile_fail, ['T15648', '-v0 -fprint-equality-relations']) +test('T15712', normal, compile_fail, ['']) test('T15793', normal, compile_fail, ['']) test('T15796', normal, compile_fail, ['']) test('T15807', normal, compile_fail, ['']) -- cgit v1.2.1