[GHC] #14083: ?

GHC ghc-devs at haskell.org
Thu Aug 3 04:48:21 UTC 2017


#14083: ?
-------------------------------------+-------------------------------------
           Reporter:  zaoqi          |             Owner:  (none)
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}

 class GEq a b where
     geq :: a -> b -> Bool

 instance {-# OVERLAPPABLE #-} (Eq a) => GEq a a where
     geq = (==)

 instance {-# OVERLAPPING #-} GEq a b where
     geq _ _ = False
 }}}
 {{{
 GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
 Prelude> :load GEq.hs
 [1 of 1] Compiling Main             ( GEq.hs, interpreted )
 Ok, modules loaded: Main.
 *Main> geq () ()

 <interactive>:2:1: error:
     • Overlapping instances for GEq () () arising from a use of ‘geq’
       Matching instances:
         instance [overlapping] [safe] GEq a b -- Defined at GEq.hs:9:30
         instance [overlappable] [safe] Eq a => GEq a a
           -- Defined at GEq.hs:6:31
     • In the expression: geq () ()
       In an equation for ‘it’: it = geq () ()
 *Main>
 }}}

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


More information about the ghc-tickets mailing list