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

GHC ghc-devs at haskell.org
Mon May 23 19:31:53 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:                    |
-------------------------------------+-------------------------------------
Changes (by rwbarton):

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


Comment:

 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 #-}`.

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


More information about the ghc-tickets mailing list