[GHC] #11947: GHC mistakenly warns about type defaulting in the presence of -XTypeApplications

GHC ghc-devs at haskell.org
Mon Apr 18 13:45:59 UTC 2016


#11947: GHC mistakenly warns about type defaulting in the presence of
-XTypeApplications
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |             Keywords:
      Resolution:                    |  TypeApplications
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 This is correct behavior.

 As described
 [http://downloads.haskell.org/~ghc/8.0.1-rc2/docs/html/users_guide/glasgow_exts.html
 #ambiguous-types-and-the-ambiguity-check here], the ambiguity check for
 `theFloatDigits` does precisely this:

 {{{
 check :: forall a. RealFloat a => Int   -- type copied from theFloatDigits
 check = theFloatDigits
 }}}

 When checking this declaration, `a` is indeed defaulted to `Double`, as
 reported. This is a consequence of the fact that `theFloatDigits`'s type
 is indeed ambiguous.

 A few ways forward here:
 1. Clarify the mechanism behind the ambiguity check in the manual. It's
 stated in there now, but we could make this more prominent and describe
 that GHC really does type-check a binding as above.
 2. Disable type defaulting in an ambiguity check.
 3. Do nothing.

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


More information about the ghc-tickets mailing list