[GHC] #5412: dataTypeConstrs gives unhelpful error message

GHC ghc-devs at haskell.org
Fri Dec 27 09:52:40 UTC 2013


#5412: dataTypeConstrs gives unhelpful error message
-------------------------------------+------------------------------------
        Reporter:  NeilMitchell      |            Owner:  klangner
            Type:  bug               |           Status:  patch
        Priority:  normal            |        Milestone:  7.6.2
       Component:  libraries/base    |          Version:  7.1
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by klangner):

 Ok. I fixed 8 previous messages.
 But I'm not sure what to do with this code:

 Case 1.
 {{{
 instance Data Char where
   toConstr x = mkCharConstr charType x
   gunfold _ z c = case constrRep c of
                     (CharConstr x) -> z x
                     _ -> error "Data.Data.gunfold(Char)"
   dataTypeOf _ = charType

 }}}

 This instance is defined for Char type. So it is not possible to pass
 wrong type here. But I guess there still could be a problem with
 constructor representation.
 There are similar instances for other data types as well. Lots of them.

 Case 2.
 In function: '''repConstr''' exception is thrown when parameters have
 different data types. So there is a need for another message. I would say
 something like:
 "Data.Data.repConstr requires the same data type for both parameters."
 or similar.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5412#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list