#3830: weird error message from type qualification mistake
------------------------------------------------+---------------------------
  Reporter:  guest                              |          Owner:               
 
      Type:  bug                                |         Status:  closed       
 
  Priority:  normal                             |      Milestone:               
 
 Component:  Compiler                           |        Version:  6.10.4       
 
Resolution:  fixed                              |       Keywords:               
 
Difficulty:                                     |             Os:  Linux        
 
  Testcase:                                     |   Architecture:  x86_64 
(amd64)
   Failure:  Incorrect warning at compile-time  |  
------------------------------------------------+---------------------------
Changes (by simonpj):

  * status:  new => closed
  * resolution:  => fixed


Old description:

> {-# 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

New description:

 {{{
 {-# 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

--

Comment:

 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

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3830#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to