Re: [GHC] #12854: ghc-8 prints mangled names in error message: ‘GHC.Base.$dm<$’

GHC ghc-devs at haskell.org
Tue Nov 22 11:49:53 UTC 2016


#12854: ghc-8 prints mangled names in error message: ‘GHC.Base.$dm<$’
-------------------------------------+-------------------------------------
        Reporter:  slyfox            |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 I can explain what is going on.  I'm not so sure how to fix it.

 You don't get an overlapping error for your `C` declarations because you
 aren't ''using'' them.  Class overlap is reported lazily; see the user
 manual.

 For the `Functor` declarations, since you omit the default method, we fill
 it in fo you
 {{{
 instance Functor (F String) where
   fmap = undefined

   ($<) = $dm< @(F String)
 }}}
 The default method comes from the original class decl, which looked like
 this
 {{{
 class  Functor f  where
     fmap        :: (a -> b) -> f a -> f b

     (<$)        :: a -> f b -> f a
     (<$)        =  fmap . const
 }}}
 From this we get
 {{{
 $dm< :: Functor f => a -> f b -> f a
 }}}
 So, in the instance decl we get the constraint `Functor (F String)`.  But
 we don't know which of the two instance decls to use to solve it, alas,
 hence the error.

 It's not very clear what a good error message would be; and even less
 clear how to achieve it!  Perhaps some more explanation in the user
 manual, along the lines above, would be a stop-gap.

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


More information about the ghc-tickets mailing list