[GHC] #13053: Inferred type for hole is not general enough

#13053: Inferred type for hole is not general enough -------------------------------------+------------------------------------- Reporter: osa1 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- As noted by @deech in #13050, inferred types for holes are sometimes not general enough. Example: {{{ Prelude> :set -XNoMonomorphismRestriction -- added this just to make sure Prelude> :t _ 1 2 <interactive>:1:1: error: ⢠Found hole: _ :: Integer -> Integer -> t Where: âtâ is a rigid type variable bound by the inferred type of it :: t at <interactive>:1:1 ⢠In the expression: _ In the expression: _ 1 2 }}} A more general type would be `(Num a, Num b) => a -> b -> t`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13053 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13053: Inferred type for hole is not general enough -------------------------------------+------------------------------------- Reporter: osa1 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.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): This is Haskell's defaulting rule at work. See section 4.3.4 of the [https://www.haskell.org/onlinereport/haskell2010/ haskell report], and GHCi's [https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html #type-defaulting-in-ghci extended defaulting rules]. I suppose that there could be some modification of the rule to prevent defaulting taking place if there were holes lying around... but I'm not sure exactly what the modification would be. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13053#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC