diff options
-rw-r--r-- | compiler/GHC/Core/Opt/ConstantFold.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Types/Literal.hs | 8 |
2 files changed, 4 insertions, 10 deletions
diff --git a/compiler/GHC/Core/Opt/ConstantFold.hs b/compiler/GHC/Core/Opt/ConstantFold.hs index b8c2c5d6fa..cb3b0a2a05 100644 --- a/compiler/GHC/Core/Opt/ConstantFold.hs +++ b/compiler/GHC/Core/Opt/ConstantFold.hs @@ -2198,7 +2198,7 @@ pattern OpVal op <- Var (isPrimOpId_maybe -> Just op) where -- | Match a literal pattern L :: Integer -> Arg CoreBndr -pattern L l <- Lit (isLitValue_maybe -> Just l) +pattern L i <- Lit (LitNumber _ i) -- | Explicit "type-class"-like dictionary for numeric primops data NumOps = NumOps @@ -2256,14 +2256,14 @@ caseRules :: Platform caseRules platform (App (App (Var f) v) (Lit l)) -- v `op` x# | Just op <- isPrimOpId_maybe f - , Just x <- isLitValue_maybe l + , LitNumber _ x <- l , Just adjust_lit <- adjustDyadicRight op x = Just (v, tx_lit_con platform adjust_lit , \v -> (App (App (Var f) (Var v)) (Lit l))) caseRules platform (App (App (Var f) (Lit l)) v) -- x# `op` v | Just op <- isPrimOpId_maybe f - , Just x <- isLitValue_maybe l + , LitNumber _ x <- l , Just adjust_lit <- adjustDyadicLeft x op = Just (v, tx_lit_con platform adjust_lit , \v -> (App (App (Var f) (Lit l)) (Var v))) diff --git a/compiler/GHC/Types/Literal.hs b/compiler/GHC/Types/Literal.hs index b208a45751..6fea5e2fdb 100644 --- a/compiler/GHC/Types/Literal.hs +++ b/compiler/GHC/Types/Literal.hs @@ -36,7 +36,7 @@ module GHC.Types.Literal , inCharRange , isZeroLit , litFitsInChar - , litValue, isLitValue, isLitValue_maybe, mapLitValue + , litValue, mapLitValue -- ** Coercions , wordToIntLit, intToWordLit @@ -71,7 +71,6 @@ import Data.ByteString (ByteString) import Data.Int import Data.Word import Data.Char -import Data.Maybe ( isJust ) import Data.Data ( Data ) import Data.Proxy import Numeric ( fromRat ) @@ -462,11 +461,6 @@ mapLitValue _ f (LitChar c) = mkLitChar (fchar c) mapLitValue platform f (LitNumber nt i) = wrapLitNumber platform (LitNumber nt (f i)) mapLitValue _ _ l = pprPanic "mapLitValue" (ppr l) --- | Indicate if the `Literal` contains an 'Integer' value, e.g. 'Char', --- 'Int', 'Word', 'LitInteger' and 'LitNatural'. -isLitValue :: Literal -> Bool -isLitValue = isJust . isLitValue_maybe - {- Coercions ~~~~~~~~~ |