[GHC] #12106: Wrong type inferenced for locally defined function

GHC ghc-devs at haskell.org
Mon May 23 19:36:31 UTC 2016


#12106: Wrong type inferenced for locally defined function
-------------------------------------+-------------------------------------
        Reporter:  syd               |                Owner:
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:  invalid           |             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 syd):

 Replying to [comment:1 rwbarton]:
 > The [http://stackoverflow.com/questions/32496864/what-is-the-
 monomorphism-restriction monomorphism restriction] applies to `myPrint`,
 so its inferred type cannot be `Show a => a -> IO ()`. It has nothing to
 do with the absense of a `Show` instance for `B` (as you can check by
 adding that instance).
 >
 > In GHCi the monomorphism restriction is disabled by default (as of a
 recent version of GHC). You can also turn it off for a module with `{-#
 LANGUAGE NoMonomorphismRestriction #-}`.

 Woops, did not know about this.
 Sorry to bother you.

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


More information about the ghc-tickets mailing list