[GHC] #16314: Improve confusing error message with MINIMAL pragma

GHC ghc-devs at haskell.org
Wed Feb 13 09:48:39 UTC 2019


#16314: Improve confusing error message with MINIMAL pragma
-------------------------------------+-------------------------------------
        Reporter:  lerkok            |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 > it would be nice to get a warning right where the class is defined, as
 opposed to where it is instantiated.

 I'm not sure that would be a good change.  Here's a typical use-case
 (taken from the user manual)
 {{{
 class Eq a where
   (==), (/=) :: a -> a -> Bool
   (==) a b = not (a /= b)
   (/=) a b = not (a == b)
   {-# MINIMAL (==) | (/=) #-}
 }}}
 Both have default methods, but you must define one or the other, or you
 get an infinite loop. At an instance we specifically want a warning, even
 though both have default methods.   This was the original motivation for
 MINIMAL.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16314#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list