Opened 3 years ago

Closed 3 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 Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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 3 years ago by simonpj

  • Owner set to simonpj

Good idea. I'll do this

comment:2 Changed 3 years ago by simonpj@…

commit c3f63fb714f38b69d93925e0b9d22b8a31e6ce17

Author: Simon Peyton Jones <simonpj@microsoft.com>
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 3 years ago by simonpj

  • Status changed from new to merge

Merge, perhpas?

comment:4 Changed 3 years ago by igloo

  • Resolution set to fixed
  • Status changed from merge to closed
Note: See TracTickets for help on using tickets.