[GHC] #10423: Can't infer Monad n from (Monad m, m ~ n)
#10423: Can't infer Monad n from (Monad m, m ~ n) -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 (Type checker) | Operating System: Unknown/Multiple Keywords: | Type of failure: None/Unknown Architecture: | Blocked By: Unknown/Multiple | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- This looks like a regression in GHC HEAD. {{{ Test/SmallCheck/Property.hs:187:10: Could not deduce (Monad n) arising from the superclasses of an instance declaration from the context: (Monad m, m ~ n) bound by the instance declaration at Test/SmallCheck/Property.hs:187:10-52 Possible fix: add (Monad n) to the context of the instance declaration In the instance declaration for ‘Testable n (Property m)’ }}} The code is here: https://github.com/feuerbach/smallcheck/blob/v1.1.1/Test/SmallCheck/Property... Originally reported here: https://github.com/feuerbach/smallcheck/issues/28 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10423> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10423: Can't infer Monad n from (Monad m, m ~ n) -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.11 checker) | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by simonpj): This is my fault, fallout from my removal of "silent superclasses". I understand what is happening here. It is clearly a bug. I think that if you replace {{{ instance (Monad m, m ~ n) => Testable n (Property m) where }}} by putting `Monad n` in the context, thus {{{ instance (Monad n, m ~ n) => Testable n (Property m) where }}} it'll probably work. It'll be a couple of weeks before I can actually fix it. Thanks very much for the report. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10423#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10423: Can't infer Monad n from (Monad m, m ~ n) -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.11 checker) | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"1189196ce7f064af408c9d16874a4c0b78f3a006/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="1189196ce7f064af408c9d16874a4c0b78f3a006" Re-do superclass solving (again); fixes #10423 TcInstDcls.tcSuperClasses was getting increasingly baroque as a succession of tickets (#10423 being the latest) pointed out that my cunning plan was not so cunning. The big issue is how to restrict the evidence that we generate for superclass constraints in an instance declaration to avoid superclass loops. See Note [Recursive superclasses] in TcInstDcls which explains the plan. The question is how to implement the plan. The new implementation is much neater, and is described in Note [Solving superclass constraints] in TcInstDcls. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10423#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10423: Can't infer Monad n from (Monad m, m ~ n) -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.11 checker) | Keywords: Resolution: | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"b1b2b44a86a34dae9eadd27af507c8b2c847ae2d/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="b1b2b44a86a34dae9eadd27af507c8b2c847ae2d" Test Trac #10423 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10423#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10423: Can't infer Monad n from (Monad m, m ~ n) -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 7.11 checker) | Keywords: Resolution: fixed | Architecture: Operating System: Unknown/Multiple | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | typecheck/should_compile/T10423 Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => typecheck/should_compile/T10423 * resolution: => fixed Comment: Fixed, thank you. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10423#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC