Opened 10 years ago

Closed 10 years ago

#3830 closed bug (fixed)

weird error message from type qualification mistake

Reported by: guest Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.10.4
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonpj)

{-# LANGUAGE GADTs, RankNTypes  #-}

data Parity a where
  Odd :: Int -> forall a. Parity (Int,Int,a)

(the "forall a" is in the wrong place) gives the error message

    Malformed constructor result type:
      forall a :: k_a3Gz. Parity (Int, Int, a)

That k_a3Gz. is a little bit cryptic.

--solrize

Attachments (1)

ladt.hs (102 bytes) - added by guest 10 years ago.
test case shown above, since wiki formatting messed it up

Download all attachments as: .zip

Change History (2)

Changed 10 years ago by guest

Attachment: ladt.hs added

test case shown above, since wiki formatting messed it up

comment:1 Changed 10 years ago by simonpj

Description: modified (diff)
Resolution: fixed
Status: newclosed

Good point. The message from 6.12 is better

T3830.hs:4:3:
    Data constructor `Odd' returns type `forall a.
                                         Parity (Int, Int, a)'
      instead of an instance of its parent type `Parity a'
    In the definition of data constructor `Odd'
    In the data type declaration for `Parity'

Nevertheless, I also added a little more info to HsTyVarBndr to prevent this kind of thing happening again.

Simon

Note: See TracTickets for help on using tickets.