Remove redundant fromIntegral calls
authorMax Bolingbroke <batterseapower@hotmail.com>
Thu, 7 Aug 2008 22:43:33 +0000 (22:43 +0000)
committerMax Bolingbroke <batterseapower@hotmail.com>
Thu, 7 Aug 2008 22:43:33 +0000 (22:43 +0000)
compiler/coreSyn/MkCore.lhs
compiler/deSugar/DsMeta.hs
compiler/deSugar/MatchLit.lhs

index b930f88..0844a0a 100644 (file)
@@ -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
index 6cc1eee..3659498 100644 (file)
@@ -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)
index b6079d3..5e30f32 100644 (file)
@@ -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)