Infinite compilation time when using wrongly ordered constraints
Hello guys! I've seen today a very strange bug in GHC 8. Namely I've got an instance:
instance {-# OVERLAPPABLE #-}
(PrimMonad m, g ~ HMGraph s rels, (g ^. t) ~ Hetero2 (MAutoVector s), s ~ PrimState m, HasProperty2' t g)
=> DynamicM t (HMGraph s rels) m a where
addM el = nested (prop2' @t . wrapped') $ (swap ∘ fmap Ptr) <∘> ixed Cont.addM (unsafeCoerce el)
and I'm using it indirectly in Main.hs. It compiles fast and works fine. The problem is that when I change the above constraint to:
(PrimMonad m, HasProperty2' t g, g ~ HMGraph s rels, (g ^. t) ~ Hetero2 (MAutoVector s), s ~ PrimState m)
Which is basically the same but with different order, the file with this constraint compiles fast and fine, but Main.hs compiles infinite amount of time (I've killed it after 10 minutes). The problem is reproducible, but it is hard right now to make minimal example out of it (we are going to a conference with a product release and we cannot track it right now).
I post it here because maybe the bug is known, if not, after the release I'll try to provide more info. If you've got any questions I'd love to assist.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | high |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |