Skip to content

Commit d24a1e0

Browse files
Recognize Integer data constructors via builtin datacons
1 parent fa05035 commit d24a1e0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

liquidhaskell-boot/src-ghc/Liquid/GHC/API.hs

+3
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ import GHC.Builtin.Types as Ghc
199199
, intTy
200200
, intTyCon
201201
, intTyConName
202+
, integerISDataCon
203+
, integerIPDataCon
204+
, integerINDataCon
202205
, liftedTypeKind
203206
, liftedTypeKindTyConName
204207
, listTyCon

liquidhaskell-boot/src/Language/Haskell/Liquid/Transforms/CoreToLogic.hs

+3-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ import Language.Haskell.Liquid.UX.Config
6262

6363
import Data.Ratio
6464
import GHC.Base ((+#), (-#), (*#))
65-
import GHC.Num
6665

6766
logicType :: (Reftable r) => Bool -> Type -> RRType r
6867
logicType allowTC τ = fromRTypeRep $ t { ty_binds = bs, ty_info = is, ty_args = as, ty_refts = rs}
@@ -574,9 +573,9 @@ ignoreVar i = simpleSymbolVar i `elem` ["I#", "D#"]
574573
-- | Tries to determine if a 'CoreAlt' maps to one of the 'Integer' type constructors.
575574
isBangInteger :: [C.CoreAlt] -> Bool
576575
isBangInteger [Alt (C.DataAlt s) _ _, Alt (C.DataAlt jp) _ _, Alt (C.DataAlt jn) _ _]
577-
= symbol s == symbol (show 'IS)
578-
&& symbol jp == symbol (show 'IP)
579-
&& symbol jn == symbol (show 'IN)
576+
= s == Ghc.integerISDataCon
577+
&& jp == Ghc.integerIPDataCon
578+
&& jn == Ghc.integerINDataCon
580579
isBangInteger _ = False
581580

582581
isErasable :: Id -> Bool

0 commit comments

Comments
 (0)