[GHC] #10770: Typeable solver has strange effects

GHC ghc-devs at haskell.org
Wed Aug 12 20:58:52 UTC 2015


#10770: Typeable solver has strange effects
-------------------------------------+-------------------------------------
              Reporter:              |             Owner:
  NeilMitchell                       |
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.10.1
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Given:

 {{{#!hs
 import Data.Typeable

 main = print $ foo $ Just ()

 foo :: Typeable (t a) => t a -> String
 foo x = let k = show $ typeOf x in k
 }}}

 I get:

 {{{
 TypeableInfer.hs:7:24:
     Could not deduce (Typeable t) arising from a use of `typeOf'
     from the context (Typeable (t a))
       bound by the type signature for
                  foo :: Typeable (t a) => t a -> String
       at TypeableInfer.hs:6:8-38
     In the second argument of `($)', namely `typeOf x'
     In the expression: show $ typeOf x
     In an equation for `k': k = show $ typeOf x
 }}}

 However, the error goes away with the minor modification of:

 {{{#!hs
 foo x = show $ typeOf x
 }}}

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


More information about the ghc-tickets mailing list