
#15931: MonoLocalBinds + MonomorphismRestriction prevents generalization for a top level definition -------------------------------------+------------------------------------- Reporter: theindigamer | Owner: (none) Type: bug | Status: new Priority: low | Milestone: ⊥ Component: Compiler | Version: 8.6.2 Keywords: | Operating System: Unknown/Multiple MonoLocalBinds, | MonomorphismRestriction | Architecture: | Type of failure: Incorrect Unknown/Multiple | error/warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Consider the following code sample {{{#!haskell {-# LANGUAGE MonoLocalBinds #-} {-# LANGUAGE MonomorphismRestriction #-} tmp = 10 picker x y = if tmp > 11 then x else y main = do print (picker "x" "y") print (picker 10 11) }}} It fails with the misleading error message "* No instance for (Num [Char]) arising from the literal `10'...", from what seems to be an interaction between MonoLocalBinds and MonomorphismRestriction (turn either off and the error goes away). Should this be happening only for local bindings, or is it correct for this error to occur for top-level definitions too? In either case, would it be possible to give a better error message here? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15931 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler