[GHC] #8392: Suggest AllowAmbiguousTypes

GHC ghc-devs
Wed Oct 2 11:15:19 UTC 2013


#8392: Suggest AllowAmbiguousTypes
--------------------------------------------+------------------------------
        Reporter:  rwbarton                 |            Owner:  simonpj
            Type:  feature request          |           Status:  new
        Priority:  normal                   |        Milestone:
       Component:  Compiler (Type checker)  |          Version:  7.7
      Resolution:                           |         Keywords:
Operating System:  Unknown/Multiple         |     Architecture:
 Type of failure:  None/Unknown             |  Unknown/Multiple
       Test Case:                           |       Difficulty:  Unknown
        Blocking:                           |       Blocked By:
                                            |  Related Tickets:
--------------------------------------------+------------------------------
Changes (by monoidal):

 * owner:  monoidal => simonpj


Comment:

 Simon: I'm passing to you. It's trivial to edit the error message in
 TcValidity.checkAmbiguity. However, this program

 {{{
 f :: Bool ~ Int => ()
 f = ()
 }}}

 gives then

 {{{
     Couldn't match type ?Bool? with ?Int?
     Inaccessible code in the type signature for f :: Bool ~ Int => ()
     To defer this ambiguity check to use sites, enable AllowAmbiguousTypes
     In the ambiguity check for: Bool ~ Int => ()
     In the type signature for ?f?: f :: Bool ~ Int => ()
 }}}

 and enabling AllowAmbiguousTypes merely changes it to

 {{{
     Couldn't match type ?Bool? with ?Int?
     Inaccessible code in the type signature for f :: Bool ~ Int => ()
 }}}

 So ambiguity check is done before checking inaccessible code, and it might
 be better to change this order. I don't know if this is simple or has any
 side effects though.

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



More information about the ghc-tickets mailing list