Error says to fix incorrect return type
Defining a constructor that returns the wrong type (non-parent type).
If the constructor is not fully-applied or over-saturated GHC reports an error, instead of telling the developer to change the return type:
Prelude> data A
Prelude> data B a where MkB :: A ()
<interactive>:2:23: error:
• Expecting one fewer argument to ‘A’
Expected kind ‘* -> *’, but ‘A’ has kind ‘*’
• In the type ‘A ()’
In the definition of data constructor ‘MkB’
In the data declaration for ‘B’
Expected:
- Suggest GADTs:
• Illegal generalised algebraic data declaration for ‘B’
(Use GADTs to allow GADTs)
• In the data declaration for ‘B’
- Complain about incorrect return type:
• Data constructor ‘MkB’ returns type ‘A’
instead of an instance of its parent type ‘B a’
• In the definition of data constructor ‘MkB’
In the data type declaration for ‘B’
It shouldn't suggest the user fix the incorrect return type
Trac metadata
Trac field | Value |
---|---|
Version | 8.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |