[GHC] #9019: Ambiguity checker overeager on "ambiguous" kind variables

GHC ghc-devs at haskell.org
Tue Apr 22 07:02:27 UTC 2014


#9019: Ambiguity checker overeager on "ambiguous" kind variables
-------------------------------------+------------------------------------
        Reporter:  goldfire          |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.8.2
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by simonpj):

 Sure it's ambiguous!  Try
 {{{
 lsoki :: Apply LeftSym0 arg ~ Left arg => Proxy arg -> LeftSym0 l
 lsoki = LSOKI
 }}}
 and you get the exact same error message.  "Ambiguous" does not mean "can
 never under any circumstances be called".

 Here's a simpler example:
 {{{
 class C (x :: Maybe a)

 data LeftSym0 where
   LSOKI :: C Nothing => LeftSym0
 }}}
 This gives
 {{{
 T9019.hs:9:3:
     Could not deduce (C k0 ('Nothing k0))
       arising from the ambiguity check for the type of the constructor
 ‘LSOKI’
     from the context (C k ('Nothing k))
       bound by the type of the constructor ‘LSOKI’:
                  C k ('Nothing k) => LeftSym0
       at T9019.hs:9:3
     The type variable ‘k0’ is ambiguous
     In the ambiguity check for:
       forall (k :: BOX). C k ('Nothing k) => LeftSym0
 }}}
 And indeed, there is nothing to resolve that ambiguous 'k', just as there
 wasn't in the previous example.

 So this looks right to me.

 Simon

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


More information about the ghc-tickets mailing list