[GHC] #16322: "deriving newtype instance" generates an infinite loop
GHC
ghc-devs at haskell.org
Fri Feb 15 00:09:57 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
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by paf31:
Old description:
> 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.
New description:
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 and DerivingStrategies:
{{{
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#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list