[GHC] #12374: Type holes show incorrect type in GHCi

GHC ghc-devs at haskell.org
Sun Jul 10 02:54:15 UTC 2016


#12374: Type holes show incorrect type in GHCi
-------------------------------------+-------------------------------------
        Reporter:  crockeea          |                Owner:
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  GHCi              |              Version:  8.0.1
      Resolution:  invalid           |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  9479, 9091        |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Iceland_jack):

 Without defaulting

 {{{
 GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
 defaulLoaded GHCi configuration from /home/baldur/.ghci
 ghci> default ()
 ghci> show _

 <interactive>:2:1: error:
     • Ambiguous type variable ‘a0’ arising from a use of ‘show’
       prevents the constraint ‘(Show a0)’ from being solved.
       Probable fix: use a type annotation to specify what ‘a0’ should be.
       These potential instances exist:
         instance Show a => Show (ZipList a)
           -- Defined in ‘Control.Applicative’
         instance Show a => Show (Down a) -- Defined in ‘Data.Ord’
         instance Show CallStack -- Defined in ‘GHC.Show’
         ...plus 28 others
         ...plus 77 instances involving out-of-scope types
         (use -fprint-potential-instances to see them all)
     • In the expression: show _
       In an equation for ‘it’: it = show _

 <interactive>:2:6: error:
     • Found hole: _ :: a0
       Where: ‘a0’ is an ambiguous type variable
     • In the first argument of ‘show’, namely ‘_’
       In the expression: show _
       In an equation for ‘it’: it = show _
     • Relevant bindings include
         it :: String (bound at <interactive>:2:1)
 ghci>
 }}}

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


More information about the ghc-tickets mailing list