[GHC] #9123: Need for higher kinded roles

GHC ghc-devs at haskell.org
Sun Feb 4 21:33:38 UTC 2018


#9123: Need for higher kinded roles
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  goldfire
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.8.2
  checker)                           |             Keywords:  Roles,
      Resolution:                    |  QuantifiedConstraints
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 I don't see any madness in this direction, given that instance lookup
 fails eagerly if there is ambiguity. For example:

 {{{#!hs
 class Eq a => Wurble a
 class D a
 class E a

 f :: ((forall a. D a => Ord a), (forall a. E a => Wurble a)) => a -> Bool
 f x = x == x
 }}}

 Under the ambiguity rule above, this would fail. Really, it's the same
 problem we have with

 {{{#!hs
 g :: ((forall a. D a => Eq a), (forall a. E a => Eq a)) => a -> Bool
 g x = x == x
 }}}

 Both examples should have the same behavior (failing). This second one
 feels easier because it looks abjectly sillier, but it's not unreasonable
 to imagine a user writing something like that, hoping that GHC will non-
 deterministically pick the right thing to do.

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


More information about the ghc-tickets mailing list