[GHC] #14368: GHC 8.2.1 doesn't inform you when the monomorphism restriction kicks in anymore

GHC ghc-devs at haskell.org
Fri Oct 20 13:14:48 UTC 2017


#14368: GHC 8.2.1 doesn't inform you when the monomorphism restriction kicks in
anymore
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.2.1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 It was an ad-hoc special case before. This is tricky to report well.  For
 example
 {{{
 f = Just (==)
 }}}
 does not give that hint.  And
 {{{
 f = (==)
 foo = (f 'c', f True)
 }}}
 gives
 {{{
     • Couldn't match expected type ‘Char’ with actual type ‘Bool’
     • In the first argument of ‘f’, namely ‘True’
 }}}
 Ironically, we do generate a warning
 {{{
   Foo.hs:7:1: warning:
       The Monomorphism Restriction applies to the binding for ‘f’
         Consider giving it a type signature
 }}}
 but since it's a warning it is suppressed when there is an error.   Maybe
 errors should not suppress warnings?

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


More information about the ghc-tickets mailing list