[GHC] #12482: Infinite compilation time when using wrongly ordered constraints

GHC ghc-devs at haskell.org
Thu Aug 11 21:29:46 UTC 2016


#12482: Infinite compilation time when using wrongly ordered constraints
-------------------------------------+-------------------------------------
           Reporter:  danilo2        |             Owner:
               Type:  bug            |            Status:  new
           Priority:  high           |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Compile-time
  Unknown/Multiple                   |  performance bug
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12482>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list