Skip to content

Commit

Permalink
Filter out constraint tuple class constructors in hasNoTypeClasses (#75)
Browse files Browse the repository at this point in the history
* Filter out constraint tuple class constructors in hasNoTypeClasses

* Update src/Test/Inspection/Core.hs

---------

Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>
  • Loading branch information
Mikolaj and nomeata authored Sep 13, 2023
1 parent c2bfd2d commit 56d9e34
Showing 1 changed file with 3 additions and 1 deletion.
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 TysWiredIn (isCTupleTyConName)
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

0 comments on commit 56d9e34

Please sign in to comment.