[GHC] #11105: Put the generic-default type in the Class

GHC ghc-devs at haskell.org
Tue Nov 17 21:08:41 UTC 2015


#11105: Put the generic-default type in the Class
-------------------------------------+-------------------------------------
           Reporter:  simonpj        |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  7.10.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:
-------------------------------------+-------------------------------------
 This is an internal GHC refactoring ticket.  Consider
 {{{
 {-# LANGUAGE DefaultSignatures #-}
 class C a where
   op :: a -> a -> Bool
   default op :: Ord a => a -> a -> Bool
   op x y = x < y
 }}}
 The `Class` object for `C` has a `ClassOpItem` that specifies
  * the name `op`
  * the type of the method `a -> a -> Bool`
  * that `op` has a generic-default signature
 BUT it does not contain the actual signature `Ord a => a -> a -> Bool`.
 That's really wrong; it is certainly part of the definition of the class,
 and we should print it out when we say `:info C` in ghci.

 Instead this type is kept solely in the top-level generic-default Id
 binding.  But that means that default-method Ids and generic-default
 method Ids are treated differently; see `gen_dm_ids` in `tcTyClDecl1` in
 `TcTyClsDecls`, and `mkDefaultMethodIds` in `TcTyDecls`.

 We should treat them uniformly.  I know how but have too much in flight to
 do it immediately.

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


More information about the ghc-tickets mailing list