Opened 4 years ago

Closed 4 years ago

#5674 closed feature request (duplicate)

Allow type signatures in instance declarations

Reported by: kprateek88 Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.2.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


GHC should allow type signatures in instance declarations. It should check that they match the type signatures from the class, and reject with an error message if not. This has the following advantages:

  • It allows a programmer to assert what he/she thinks is the type signature of the function being defined, and have it checked against what it should be. If the programmer is wrong, this will be immediately apparent with the error message, instead of a potentially obscure type error.
  • A programmer can consistently follow the (reasonable) coding style of always writing type signatures for functions, without being hindered by "Misplaced type signature" errors and having to make a special case for instance declarations by commenting out (or removing) the type signature.

Change History (2)

comment:1 Changed 4 years ago by simonpj

Dup of #5676.

comment:2 Changed 4 years ago by simonmar

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