From 48d1866e9051e52b80c9c88547bd66d66483f1d5 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Fri, 10 Mar 2017 11:46:50 +0000 Subject: Improve error messages for skolems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In error messages like this • Couldn't match type ‘c’ with ‘f0 (a -> b)’ ‘c’ is a rigid type variable bound by the type signature for: f :: ((a -> b) -> b) -> forall c. c -> a we need to take case both to actually show that 'forall c', and to make sure that its name lines with the 'c' in the error message. This has been shaky for some time, and this commit puts it on solid ground. See TcRnTypes: Note [SigSkol SkolemInfo] The main changes are * SigSkol gets an extra field that records the way in which the type signature was skolemised. * The type in SigSkol is now the /un/-skolemised version * pprSkolemInfo uses the info to make the tidy type line up nicely Lots of error message wibbles! --- testsuite/tests/monadfail/MonadFailErrors.stderr | 4 ++-- testsuite/tests/monadfail/MonadFailWarnings.stderr | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'testsuite/tests/monadfail') diff --git a/testsuite/tests/monadfail/MonadFailErrors.stderr b/testsuite/tests/monadfail/MonadFailErrors.stderr index 1507984d14..81ad56c910 100644 --- a/testsuite/tests/monadfail/MonadFailErrors.stderr +++ b/testsuite/tests/monadfail/MonadFailErrors.stderr @@ -5,12 +5,12 @@ MonadFailErrors.hs:16:5: error: with the failable pattern ‘Just x’ from the context: Monad m bound by the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a at MonadFailErrors.hs:14:1-25 Possible fix: add (MonadFail m) to the context of the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a • In a stmt of a 'do' block: Just x <- undefined In the expression: do Just x <- undefined diff --git a/testsuite/tests/monadfail/MonadFailWarnings.stderr b/testsuite/tests/monadfail/MonadFailWarnings.stderr index ac16d6cd9e..7471bd9373 100644 --- a/testsuite/tests/monadfail/MonadFailWarnings.stderr +++ b/testsuite/tests/monadfail/MonadFailWarnings.stderr @@ -5,12 +5,12 @@ MonadFailWarnings.hs:19:5: warning: [-Wmissing-monadfail-instances (in -Wcompat) (this will become an error in a future GHC release) from the context: Monad m bound by the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a at MonadFailWarnings.hs:17:1-25 Possible fix: add (MonadFail m) to the context of the type signature for: - general :: Monad m => m a + general :: forall (m :: * -> *) a. Monad m => m a • In a stmt of a 'do' block: Just x <- undefined In the expression: do Just x <- undefined -- cgit v1.2.1