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

GHC ghc-devs at haskell.org
Sat Aug 26 15:23:30 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:                    |
-------------------------------------+-------------------------------------
Changes (by goldfire):

 * cc: RyanGlScott (removed)


Comment:

 This looks like correct behavior to me. Presumably, you want `flip give ::
 (Given a => r) -> a -> r`, but getting that would require impredicativity.
 The results GHC provides seem in accordance with, e.g.,
 [http://cs.brynmawr.edu/~rae/papers/2016/type-app/visible-type-app.pdf
 this paper].

 It is similar with the definition of `f`. Presumably, you want `f` to have
 the same type as `give`, but that would require inferring a higher-rank
 type, something that GHC avoids.

 Do close if you agree with this analysis. Thanks.

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


More information about the ghc-tickets mailing list