[GHC] #12493: Add gcoerceWith to Data.Type.Coercion

GHC ghc-devs at haskell.org
Mon Aug 15 17:33:24 UTC 2016


#12493: Add gcoerceWith to Data.Type.Coercion
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:  8.2.1
          Component:                 |           Version:  8.0.1
  libraries/base                     |
           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:
-------------------------------------+-------------------------------------
 Haskell libraries mailing list discussion:
 https://mail.haskell.org/pipermail/libraries/2016-July/027207.html


 > In Data.Type.Equality, we have both
 >
 > {{{#!hs
 > castWith :: (a :~: b) -> a -> b
 > }}}
 >
 > and
 >
 > {{{#!hs
 > gcastWith :: (a :~: b) -> (a ~ b => r) -> r
 > }}}
 >
 >
 > But in `Data.Type.Coercion` we only have
 >
 > {{{#!hs
 > coerceWith :: Coercion a b -> a -> b
 > }}}
 >
 > It seems to me that for the sake of consistency, we should add
 >
 > {{{#!hs
 > gcoerceWith :: Coercion a b -> (Coercible a b => r) -> r
 > gcoerceWith Coercion a = a
 > }}}
 >
 > David Feuer

 I've wanted this too. Patch incoming.

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


More information about the ghc-tickets mailing list