[GHC] #14157: Flipping (give :: a -> (Given a => r) -> r) has type (r -> a -> r)

GHC ghc-devs at haskell.org
Sat Aug 26 15:12:12 UTC 2017


#14157: Flipping (give :: a -> (Given a => r) -> r) has type (r -> a -> r)
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by Iceland_jack:

Old description:

> [https://hackage.haskell.org/package/reflection-2.1.2/docs/Data-
> Reflection.html#v:give give] from the ''reflection'' library has the
> following type
>
> {{{#!hs
> give :: forall a r. a -> (Given a => r) -> r
> }}}
>
> but `flip give :: r -> a -> r`!
>
> This works with our own `Given`, `give`
>
> {{{
> $ ghci -ignore-dot-ghci -XRankNTypes
> GHCi, version 8.3.20170605: http://www.haskell.org/ghc/  :? for help
> Prelude> class Given a
> Prelude> give :: a -> (Given a => r) -> r; give = undefined
> Prelude> :t flip give
> flip give :: c -> a -> c
> Prelude>
> }}}

New description:

 [https://hackage.haskell.org/package/reflection-2.1.2/docs/Data-
 Reflection.html#v:give give] from the ''reflection'' library has the
 following type

 {{{#!hs
 give :: forall a r. a -> (Given a => r) -> r
 }}}

 but `flip give :: r -> a -> r`!

 Same happens with our own `Given`, `give`

 {{{
 $ ghci -ignore-dot-ghci -XRankNTypes
 GHCi, version 8.3.20170605: http://www.haskell.org/ghc/  :? for help
 Prelude> class Given a
 Prelude> give :: a -> (Given a => r) -> r; give = undefined
 Prelude> :t flip give
 flip give :: c -> a -> c
 Prelude>
 }}}

--

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


More information about the ghc-tickets mailing list