
#9443: Regression from 7.6.3 to 7.8.3: could not coerce because argument "has role Nominal" -------------------------------------+------------------------------------- Reporter: bernalex | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Keywords: | Operating System: Architecture: x86_64 (amd64) | Unknown/Multiple Difficulty: Unknown | Type of failure: GHC Blocked By: | rejects valid program Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- This file works fine with 7.6.3: https://github.com/plaimi/plailude/blob/master/src/Data/Time/Units.hs But with 7.8.3, every newtype has an error message like: {{{ Could not coerce from ‘TimeUnit Integer’ to ‘TimeUnit (Year a)’ || because the first type argument of ‘TimeUnit’ has role Nominal, || but the arguments ‘Integer’ and ‘Year a’ differ || arising from the coercion of the method ‘timeVal’ from type || ‘forall n. (TimeUnit Integer, Num n) => Integer -> n’ to type || ‘forall n. (TimeUnit (Year a), Num n) => Year a -> n’ }}} To make the code work again, I need to remove a redundant type constraint from: {{{#!hs class TimeUnit t where timeVal :: (TimeUnit t, Num n) => t -> n }}} Turning it into: {{{#!hs class TimeUnit t where timeVal :: Num n => t -> n }}} The constraint is redundant because it is already implied by 'class TimeUnit t'. I suspect this is a regression. I would be happy to work on it, but I don't have time right now, so I'm putting it here for visibility, feedback, and to remember it in the first place. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9443 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler