auto-derivation of Enum is disallowed with recursive imports
A data type with one single-parameter constructor can normally be declared deriving(Enum) when compiling with -fglasgow-exts. However, when the data type is also declared in a hs-boot file, this is not accepted. The following test case demonstrates the problem. The same thing happens if the 'deriving' clause is also present in the hs-boot file.
{- file X.hs-boot -}
module X where
newtype X = X Int
{- file X.hs -}
module X where
import {-# SOURCE #-} X
newtype X = X Int deriving(Enum)
ghc -c -fglasgow-exts X.hs-boot X.hs
The error occurs in X.hs: Can't make a derived instance of
Enum X' (X' has non-nullary constructors)
Trac metadata
Trac field | Value |
---|---|
Version | 6.6 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |