[GHC] #16322: "deriving newtype instance" generates an infinite loop

GHC ghc-devs at haskell.org
Fri Feb 15 00:09:27 UTC 2019


#16322: "deriving newtype instance" generates an infinite loop
-------------------------------------+-------------------------------------
           Reporter:  paf31          |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.6.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I was trying to create a newtype instance for the
 `SqlSelect`(https://hackage.haskell.org/package/esqueleto-2.5.3/docs
 /Database-Esqueleto-Internal-Sql.html#t:SqlSelect) class from the
 `esqueleto` library. It has multiple type arguments so I was using
 StandaloneDeriving:

 {{{
 newtype X a b = X { unX :: b }

 deriving newtype instance SqlSelect b c => SqlSelect (X a b) (X a c)
 }}}


 Unfortunately, this generates code which must include an infinite loop,
 because the compiled code spins, but replacing it with the obvious
 handwritten instance seems to fix the problem.

 Apologies if this has been reported or fixed elsewhere, I was unable to
 find any matching issues.

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


More information about the ghc-tickets mailing list