Opened 6 years ago

Closed 6 years ago

#5331 closed feature request (fixed)

Warning for unused existentially quantified types

Reported by: Lemming Owned by: simonpj
Priority: normal Milestone:
Component: Compiler Version: 6.12.3
Keywords: Cc: ghc@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


I found a bug in my code that boils down to:

{-# LANGUAGE ExistentialQuantification #-}

data X = forall a b. X a

Obviously the type 'b' is not used. It didn't hurt, but it could have been, that I intended to do something with the 'b' and then forgot it. I would like to get a warning in this situation like "Unused type variable 'b'".

It might even be, that no existential quantification is needed at all, as in the following case:

data Y = forall a. Y

Change History (4)

comment:1 Changed 6 years ago by simonpj

Owner: set to simonpj

Good idea. I'll do this

comment:2 Changed 6 years ago by simonpj@…

commit c3f63fb714f38b69d93925e0b9d22b8a31e6ce17

Author: Simon Peyton Jones <>
Date:   Wed Jul 20 15:31:40 2011 +0100

    Report on unused type variables (fixes #5331)
    We were doing this already for explicit types like
       f :: forall a. Int
    but not for constructor declarations.  This patch
    makes it consistent.

 compiler/rename/RnBinds.lhs  |    9 +++++--
 compiler/rename/RnSource.lhs |   16 +++++++++-----
 compiler/rename/RnTypes.lhs  |   45 ++++++++++++++++++++++-------------------
 3 files changed, 40 insertions(+), 30 deletions(-)

comment:3 Changed 6 years ago by simonpj

Status: newmerge

Merge, perhpas?

comment:4 Changed 6 years ago by igloo

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.