Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out constraint tuple class constructors in hasNoTypeClasses #75

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Test/Inspection/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module Test.Inspection.Core
) where

#if MIN_VERSION_ghc(9,0,0)
import GHC.Builtin.Types (isCTupleTyConName)
import GHC.Core
import GHC.Core.Utils
import GHC.Core.TyCo.Rep
Expand All @@ -31,6 +32,7 @@ import GHC.Utils.Misc
import GHC.Core.DataCon
import GHC.Core.TyCon (TyCon, isClassTyCon)
#else
import Builtin.Types (isCTupleTyConName) -- only guessing the module name
nomeata marked this conversation as resolved.
Show resolved Hide resolved
import CoreSyn
import CoreUtils
import CoreSubst
Expand Down Expand Up @@ -552,7 +554,7 @@ doesNotAllocate slice = listToMaybe [ (v,e) | (v,e) <- slice, not (go (idArity v

doesNotContainTypeClasses :: Slice -> [Name] -> Maybe (Var, CoreExpr, [TyCon])
doesNotContainTypeClasses slice tcNs
= allTyCons (\tc -> not (isClassTyCon tc) || any (getName tc ==) tcNs) slice
= allTyCons (\tc -> not (isClassTyCon tc) || isCTupleTyConName (getName tc) || any (getName tc ==) tcNs) slice

rename :: [(Var, Var)] -> CoreExpr -> CoreExpr
rename rn = substExpr' sub where
Expand Down
Loading