Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Trouble specializing generic functions with extra arguments or constraints
## Summary Generic-derived methods for recursively defined types can't specialize to extra constraints. ## Steps to reproduce ```haskell {-# options_ghc -O2 -ddump-simpl -dsuppress-coercions -dsuppress-type-applications #-} {-# language DeriveGeneric #-} module Aha where import Control.DeepSeq import GHC.Generics data MyList a = Nil | Cons a (MyList a) deriving Generic instance NFData a => NFData (MyList a) ``` Compiling this, I get ```haskell Rec { -- RHS size: {terms: 15, types: 13, coercions: 2, joins: 0/0} Aha.$fNFDataMyList_$crnf [Occ=LoopBreaker] :: forall a. NFData a => MyList a -> () [GblId, Arity=2, Str=<LCL(A)><1L>, Unf=OtherCon []] Aha.$fNFDataMyList_$crnf = \ (@a_a3bP) ($dNFData_a3bQ :: NFData a_a3bP) (eta_B0 :: MyList a_a3bP) -> case eta_B0 of { Nil -> GHC.Tuple.(); Cons g1_a39r g2_a39s -> case ($dNFData_a3bQ `cast` <Co:2>) g1_a39r of { () -> Aha.$fNFDataMyList_$crnf $dNFData_a3bQ g2_a39s } } end Rec } ``` Uh oh... this is a loop breaker with no unfolding, so it can't specialize to the underlying `NFData a` instance! ## Expected behavior I would expect specialization (or something?) to effectively apply the static argument transformation to the `NFData a` dictionary, pulling it out of the loop. Unfortunately, that will do nothing for higher-order functions like generic versions of `traverse`; I have no clue how to approach specializing those to their arguments without a more general fix to the static argument issue. ## Environment * GHC version used: 9.2.1 Optional: * Operating System: * System Architecture:
issue