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

GHC ghc-devs at haskell.org
Wed Oct 7 08:12:40 UTC 2015


#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


More information about the ghc-tickets mailing list