Skip to content

dataTypeConstrs gives unhelpful error message

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
Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information