[GHC] #15431: Coercible and Existential types don't play nicely

GHC ghc-devs at haskell.org
Mon Jul 23 02:48:24 UTC 2018


#15431: Coercible and Existential types don't play nicely
-------------------------------------+-------------------------------------
           Reporter:  NioBium        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.4.3
           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:
-------------------------------------+-------------------------------------
 In the following example, {{{f}}} compiles but {{{g}}} doesn't.

 {{{
 data T t where
   A :: Show (t a) => t a -> T t
   B :: Coercible Int (t a) => t a -> T t

 f :: T t -> String
 f (A t) = show t

 g :: T t -> Int
 g (B t) = coerce t

 • Couldn't match representation of type ‘Int’ with that of ‘t a’
   Inaccessible code in
     a pattern with constructor:
       B :: forall k (t :: k -> *) (a :: k).
            Coercible Int (t a) =>
            t a -> T t,
     in an equation for ‘g’
 • In the pattern: B t
   In an equation for ‘g’: g (B t) = coerce t
 }}}

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


More information about the ghc-tickets mailing list