ghc-tcplugin-api
ghc-tcplugin-api copied to clipboard
Add a compatibility helper for `TcPluginSolveResult`
Something like this:
mkTcPluginSolveResult :: [Ct] -> [(EvTerm, Ct)] -> [Ct] -> TcPluginSolveResult
#if MIN_VERSION_ghc(9,3,0)
mkTcPluginSolveResult = TcPluginSolveResult
#else
mkTcPluginSolveResult contras solved new =
-- On GHC 9.2 and below, it's not possible to return
-- both contradictions and solved/new constraints.
if null contras
then TcPluginOk solved new
else TcPluginContradiction contras
#endif