Skip to content

Commit

Permalink
Emit derived instances for GHC >=8.10
Browse files Browse the repository at this point in the history
GHC changed the way that derived instances are processed.  The new code
closely follows code from newer GHC versions, namely in the function
`tcTyClsInstDecls`.
  • Loading branch information
Nicholas Coltharp committed Jul 17, 2024
1 parent b48f979 commit cbd3c9e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/HsToCoq/Util/GHC/Deriving.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ import Type
import TcType
import HscTypes
import TcInstDcls
#if __GLASGOW_HASKELL__ >= 810
import TcTyClsDecls
#endif
import Module
import SrcLoc
import FastString
Expand All @@ -58,7 +61,8 @@ addDerivedInstances tcm = do
-- so that GHC will allow us to re-typecheck existing instances
setGblEnv tcg_env_hack $
#if __GLASGOW_HASKELL__ >= 810
tcInstDeclsDeriv [] (hs_derivds hsgroup)
do (_, _, deriv_info) <- tcTyAndClassDecls (hs_tyclds hsgroup)
tcInstDeclsDeriv deriv_info (hs_derivds hsgroup)
#else
tcInstDeclsDeriv [] (hs_tyclds hsgroup >>= group_tyclds) (hs_derivds hsgroup)
#endif
Expand Down

0 comments on commit cbd3c9e

Please sign in to comment.