[GHC] #12240: Common Sense for Type Classes

GHC ghc-devs at haskell.org
Wed Jun 29 00:28:44 UTC 2016


#12240: Common Sense for Type Classes
-------------------------------------+-------------------------------------
           Reporter:  Mathnerd314    |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  GHC rejects
  Unknown/Multiple                   |  valid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 GHC erroneously reports that there is "No instance of C". But, in fact,
 there is an instance, `C Int Char`; furthermore, it is the only instance.
 So GHC should use it!

 {{{#!hs

 {-# LANGUAGE MultiParamTypeClasses #-}
 module T4921 where

 class C a b where
     f :: (a,b)

 instance C Int Char where
     f = undefined

 x = fst f
 y = fst f :: Int
 }}}

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


More information about the ghc-tickets mailing list