[GHC] #10939: Odditites regarding Any and typeclasses.

#10939: Odditites regarding Any and typeclasses. -------------------------------------+------------------------------------- Reporter: mniip | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC rejects Unknown/Multiple | valid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | -------------------------------------+------------------------------------- The typechecker seems to be unable to operate on contexts containing "naked" `Any`, for example: {{{#!hs x :: State [Any] () x = put [] }}} {{{ No instance for (MonadState [Any] (StateT [Any] Identity)) arising from a use of ‘put’ }}} A more minimal self-contained example would be: {{{#!hs {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-} import GHC.Prim (Any) class Class a b where method :: a -> b instance Class a a where method = id x :: Any -> Any x = method }}} {{{ No instance for (Class Any Any) arising from a use of ‘method’ }}} It's quite obvious why this error happens (`Any` is not a datatype), however it also feels like it shouldn't happen. All of the above code seems to work in 7.8, which is back when `Any` was a datatype. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10939 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10939: Odditites regarding Any and typeclasses. -------------------------------------+------------------------------------- Reporter: mniip | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.10.2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): -------------------------------------+------------------------------------- Comment (by thomie): Your second example compiles fine with HEAD (ghc-7.11.20151002). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10939#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10939: Odditites regarding Any and typeclasses. -------------------------------------+------------------------------------- Reporter: mniip | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 7.10.2 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * resolution: => fixed Comment: Confirmed that the first example works, too. I'm not sure what the fix is, though. I'm closing as fixed. If this is holding you up and you want the fix in 7.10.3, reopen and we can try to learn more. Thanks for reporting! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10939#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC