
#14782: typeclass polymorphism defeats bang patterns -------------------------------------+------------------------------------- Reporter: dmwit | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: invalid | Keywords: | MonomorphismRestriction 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 dmwit): Okay, I think I understand your explanation. But the more I think about this, the more it seems like there is still something a bit off in the current implementation. Here's an almost identical example, but with `Monoid` instead of `Num` to avoid having to think about defaulting: {{{ {-# LANGUAGE BangPatterns #-} main = let n :: Monoid a => a; !n = undefined in return () }}} Now that I have thought more carefully about what this means, I no longer understand why this is allowed to pass the type checker. If I'm following what you're saying, it seems like it ought to be an ambiguous type error, for exactly the same reason `main = seq (undefined :: Monoid a => a) (return ())` is. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14782#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler