[GHC] #12390: List rules for `Coercible` instances

GHC ghc-devs at haskell.org
Thu Jul 14 03:14:29 UTC 2016


#12390: List rules for `Coercible` instances
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           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:
-------------------------------------+-------------------------------------
 `:info` on
 [https://downloads.haskell.org/~ghc/7.8.2/docs/html/libraries/base-4.7.0.0
 /Data-Coerce.html#t:Coercible Data.Coerce.Coercible] doesn't display any
 instances, it's a special class so it should be special-cased

 {{{
 ghci> :i Coercible
 type role Coercible representational representational
 class a ~R# b => Coercible (a :: k) (b :: k)
         -- Defined in ‘GHC.Types’
 }}}

 The base case would be easy to display:

 {{{#!hs
 instance Coercible a a -- Generated on the fly
 }}}

 but it's trickier to describe the … instance succinctly:

 {{{#!hs
 instance Coercible b b' => Coercible (D a b c) (D a b' c')
 }}}

 same for newtypes.

 ----

 Maybe it's better to list concrete examples

 {{{#!hs
 coerce @(Reader _ _)
   :: Reader a b -> (a -> Identity b)
 }}}

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


More information about the ghc-tickets mailing list