Ticket #2523 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

Improve warnings for use of "forall" without -XExistentialQuantification

Reported by: dmhouse Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.8.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Here's a GHCi session:

Prelude> let foo :: forall a. a; foo = undefined

<interactive>:1:19:
    Illegal operator `.' in type `forall a . a'
      (Use -XTypeOperators to allow operators in types)
Prelude> let foo :: forall a. Show a => a; foo = undefined
<interactive>:1:28: parse error on input `=>'

Both of these errors could be improved, I think, by detecting the use of 'forall' as a type variable name, and suggesting -XExistentialQuantification if it's being used.

Change History

Changed 5 years ago by simonpj

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to fixed

Good idea.

Prelude> let foo :: forall a. a; foo = undefined

<interactive>:1:19:
    Illegal operator `.' in type `forall a . a'
      Perhaps you intended to use -XRankNTypes or similar flag
      to enable explicit-forall syntax: forall <tvs>. <type>
Prelude> 

Patch is this

Thu Aug 21 13:35:02 GMT Daylight Time 2008  simonpj@microsoft.com
  * Improve error message when 'forall' is not a keyword

Simon

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.