
#11384: Error says to fix incorrect return type -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Keywords: GADTs | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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: 1. Suggest GADTs: {{{ • Illegal generalised algebraic data declaration for ‘B’ (Use GADTs to allow GADTs) • In the data declaration for ‘B’ }}} 2. 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 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11384 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler