[GHC] #8392: Suggest AllowAmbiguousTypes
#8392: Suggest AllowAmbiguousTypes -------------------------------------------+------------------------------- Reporter: rwbarton | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.7 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: -------------------------------------------+------------------------------- The error message I get with GHC HEAD on the example program in #8390: {{{ tf.hs:38:10: Could not deduce (Fun g a b0) arising from the ambiguity check for an instance declaration from the context (Fun f b c, Fun g a b) bound by an instance declaration: (Fun f b c, Fun g a b) => Fun (Compose f g) a c at tf.hs:38:10-56 The type variable ‛b0’ is ambiguous In the ambiguity check for: forall f g a c b. (Fun f b c, Fun g a b) => Fun (Compose f g) a c In the instance declaration for ‛Fun (Compose f g) a c’ }}} could perhaps benefit from an appended line: {{{ (To defer this ambiguity check to use sites, enable AllowAmbiguousTypes) }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8392> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8392: Suggest AllowAmbiguousTypes --------------------------------------------+------------------------------ Reporter: rwbarton | Owner: monoidal 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 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8392#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8392: Suggest AllowAmbiguousTypes --------------------------------------------+------------------------------ Reporter: rwbarton | Owner: monoidal 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: --------------------------------------------+------------------------------ Comment (by simonpj): Actually I'm in the area so I can do this. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8392#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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
#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: --------------------------------------------+------------------------------ Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:41f708b6e0f4c73eb652045a1b9b4254eec97234/testsuite]: {{{ #!CommitTicketReference repository="testsuite" revision="41f708b6e0f4c73eb652045a1b9b4254eec97234" Test Trac #8392 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8392#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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: --------------------------------------------+------------------------------ Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:43856a003c9abb1bf8bf1822e6e7f5781b16ac4d/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="43856a003c9abb1bf8bf1822e6e7f5781b16ac4d" Improve -XAllowAmbiguousTypes (Trac #8392) * Add a suggestion to add AllowAmbiguousTypes when there is an ambiguity error * Move some of the logic to tcSimplifyAmbiguityCheck * Report inaccessible code regardless of the ambiguity check }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8392#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8392: Suggest AllowAmbiguousTypes -------------------------------------------------+------------------------- Reporter: rwbarton | Owner: Type: feature request | simonpj Priority: normal | Status: Component: Compiler (Type checker) | closed Resolution: fixed | Milestone: Operating System: Unknown/Multiple | Version: 7.7 Type of failure: None/Unknown | Keywords: Test Case: | Architecture: typecheck/should_fail/T8392a, | Unknown/Multiple typecheck/should_compile/T8392 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Changes (by simonpj): * status: new => closed * testcase: => typecheck/should_fail/T8392a, typecheck/should_compile/T8392 * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8392#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC