Commit 393f2662 authored by batterseapower's avatar batterseapower
Browse files

Remove redundant fromIntegral calls

parent 2e065952
......@@ -7,8 +7,9 @@ module MkCore (
mkCoreLams,
-- * Constructing boxed literals
mkWordExpr,
mkIntExpr, mkIntegerExpr,
mkWordExpr, mkWordExprWord,
mkIntExpr, mkIntExprInt,
mkIntegerExpr,
mkFloatExpr, mkDoubleExpr,
mkCharExpr, mkStringExpr, mkStringExprFS,
......@@ -216,12 +217,20 @@ mkCoreLams = mkLams
\begin{code}
-- | Create a 'CoreExpr' which will evaluate to the given @Int@
mkIntExpr :: Int -> CoreExpr -- Result = I# i :: Int
mkIntExpr i = mkConApp intDataCon [mkIntLitInt i]
mkIntExpr :: Integer -> CoreExpr -- Result = I# i :: Int
mkIntExpr i = mkConApp intDataCon [mkIntLit i]
-- | Create a 'CoreExpr' which will evaluate to the given @Int@
mkIntExprInt :: Int -> CoreExpr -- Result = I# i :: Int
mkIntExprInt i = mkConApp intDataCon [mkIntLitInt i]
-- | Create a 'CoreExpr' which will evaluate to the a @Word@ with the given value
mkWordExpr :: Integer -> CoreExpr
mkWordExpr w = mkConApp wordDataCon [mkWordLit w]
-- | Create a 'CoreExpr' which will evaluate to the given @Word@
mkWordExpr :: Word -> CoreExpr
mkWordExpr w = mkConApp wordDataCon [mkWordLitWord w]
mkWordExprWord :: Word -> CoreExpr
mkWordExprWord w = mkConApp wordDataCon [mkWordLitWord w]
-- | Create a 'CoreExpr' which will evaluate to the given @Integer@
mkIntegerExpr :: MonadThings m => Integer -> m CoreExpr -- Result :: Integer
......
......@@ -1250,7 +1250,7 @@ repNamedTyCon (MkC s) = rep2 conTName [s]
repTupleTyCon :: Int -> DsM (Core TH.TypeQ)
-- Note: not Core Int; it's easier to be direct here
repTupleTyCon i = rep2 tupleTName [mkIntExpr (fromIntegral i)]
repTupleTyCon i = rep2 tupleTName [mkIntExprInt i]
repArrowTyCon :: DsM (Core TH.TypeQ)
repArrowTyCon = rep2 arrowTName []
......@@ -1345,7 +1345,7 @@ coreStringLit :: String -> DsM (Core String)
coreStringLit s = do { z <- mkStringExpr s; return(MkC z) }
coreIntLit :: Int -> DsM (Core Int)
coreIntLit i = return (MkC (mkIntExpr (fromIntegral i)))
coreIntLit i = return (MkC (mkIntExprInt i))
coreVar :: Id -> Core TH.Name -- The Id has type Name
coreVar id = MkC (Var id)
......
......@@ -72,7 +72,7 @@ dsLit (HsDoublePrim d) = return (Lit (MachDouble d))
dsLit (HsChar c) = return (mkCharExpr c)
dsLit (HsString str) = mkStringExprFS str
dsLit (HsInteger i _) = mkIntegerExpr i
dsLit (HsInt i) = return (mkIntExpr (fromIntegral i))
dsLit (HsInt i) = return (mkIntExpr i)
dsLit (HsRat r ty) = do
num <- mkIntegerExpr (numerator r)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment