Regression from 7.6.3 to 7.8.3: could not coerce because argument "has role Nominal"
This file works fine with 7.6.3: <https://github.com/plaimi/plailude/blob/25d2a811a5d1b9b48ae8534bca10cc3798307cbc/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:
class TimeUnit t where timeVal :: (TimeUnit t, Num n) => t -> n
Turning it into:
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.