[GHC] #11674: GHC accepts overly general instance sigs

GHC ghc-devs at haskell.org
Fri Mar 4 17:29:52 UTC 2016


#11674: GHC accepts overly general instance sigs
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:  invalid           |             Keywords:  InstanceSigs
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC accepts       |  Unknown/Multiple
  invalid program                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 That's fine. It's equivalent to this
 {{{
 instance Functor I where
   fmap = fmapI

 fmapI :: (a -> b) -> f a -> f b
 fmapI = undefined
 }}}
 So we check (a) that the defined function has the specified type, and (b)
 that a function of the specified type is acceptable in the instance decl.

 See 9.7.3.7 under http://downloads.haskell.org/~ghc/master/users-
 guide/glasgow_exts.html#instance-declarations.

 If the documentation should be clearer, could you suggest alternative
 wording that would have made it clearer?  Thanks!

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


More information about the ghc-tickets mailing list