[GHC] #7775: Mark intentionally omitted type class instances

#7775: Mark intentionally omitted type class instances -----------------------------+---------------------------------------------- Reporter: Lemming | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.6.2 | Keywords: instance warning Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- In GHCi I get {{{ Prelude> 2+3::Char <interactive>:2:2: No instance for (Num Char) arising from a use of `+' Possible fix: add an instance declaration for (Num Char) In the expression: 2 + 3 :: Char In an equation for `it': it = 2 + 3 :: Char }}} In many cases users now actually try to implement the instance Num Char, but this is certainly not a good idea. I would like to tell the user whenever an instance is intentionally unimplemented and why it is missing. Like so {{{ {-# NOINSTANCE Num Char where "There is no sound arithmetic on characters." #-} }}} The syntax after NOINSTANCE should be like in an instance declaration. It shall be treated like a type class instance, e.g. it shall be checked whether the same instance already exists, or whether it is orphan, or whether it is not Haskell 98, and it should require to enable according extensions like MultiParamTypeClasses. If on resolution a non-instance is chosen then the compiler should print the custom warning "There is no sound arithmetic on characters." instead of "probable fix: add instance". -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7775 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7775: Mark intentionally omitted type class instances -----------------------------+---------------------------------------------- Reporter: Lemming | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.6.2 | Keywords: instance warning Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by monoidal): The "possible fix" message was already removed in 7.6 (#7222). -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7775#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7775: Mark intentionally omitted type class instances --------------------------------------+------------------------------------- Reporter: Lemming | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.2 Resolution: wontfix | Keywords: instance warning Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: --------------------------------------+------------------------------------- Changes (by igloo): * status: new => closed * difficulty: => Unknown * resolution: => wontfix Comment: Thanks for the suggestions. However, I think that now that the misleading advice has been removed, it's not worth implementing the pragma, so I'm closing this ticket. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7775#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC