#5412: dataTypeConstrs gives unhelpful error message
---------------------------------+------------------------------------------
    Reporter:  NeilMitchell      |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  normal            |    Milestone:              
   Component:  libraries/base    |      Version:  7.1         
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Old description:

> Take the following program:
>
> {{{
> import Data.Data
> foo = dataTypeConstrs (dataTypeOf (0 :: Int))
> -- raises: *** Exception: Data.Data.dataTypeConstrs
> }}}
>
> The implementation of {{{dataTypeConstrs}}} has the type available as a
> string at this point, so could easily say:
>
> {{{Exception: Data.Data.dataTypeConstrs is not supported for Int, as it
> is not an algebraic data type}}}

New description:

 Take the following program:

 {{{
 import Data.Data
 foo = dataTypeConstrs (dataTypeOf (0 :: Int))
 -- raises: *** Exception: Data.Data.dataTypeConstrs
 }}}

 The implementation of {{{dataTypeConstrs}}} has the type available as a
 string at this point, so could easily say:

 {{{
 Exception: Data.Data.dataTypeConstrs is not supported for Int,
            as it is not an algebraic data type
 }}}

--

Comment(by simonpj):

 Good idea!  Could you send a patch?  Thanks!

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5412#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