on master help sign in
Replace the few last uses of div with quot
commit6b929431149311fc742582008fbbd0bf9123ea09 authorBryan O'Sullivan <bos@serpentine.com> dateSun 21 Apr 2013, 10:37 (13 years ago) parent587f61c
3 files changed+11−11
Data/Text.hs+7−7 Data/Text/Fusion/Size.hs+2−2 Data/Text/Lazy.hs+2−2
Data/Text.hs+7−7
@@ -189,7 +189,7 @@ import Prelude (Char, Bool(..), Int, Maybe(..), String,
189189 Eq(..), Ord(..), Ordering(..), (++),
190190 Read(..), Show(..),
191191 (&&), (||), (+), (-), (.), ($), ($!), (>>), (*),
192− div, maxBound, not, return, otherwise)
192+ maxBound, not, return, otherwise, quot)
193193#if defined(HAVE_DEEPSEQ)
194194import Control.DeepSeq (NFData)
195195#endif
@@ -734,7 +734,7 @@ center k c t
734734 | otherwise = replicateChar l c `append` t `append` replicateChar r c
735735 where len = length t
736736 d = k - len
737− r = d `div` 2
737+ r = d `quot` 2
738738 l = d - r
739739{-# INLINE center #-}
740740
@@ -906,11 +906,11 @@ mapAccumR f z0 = second reverse . S.mapAccumL g z0 . reverseStream
906906-- @t@ repeated @n@ times.
907907replicate :: Int -> Text -> Text
908908replicate n t@(Text a o l)
909− | n <= 0 || l <= 0 = empty
910− | n == 1 = t
911− | isSingleton t = replicateChar n (unsafeHead t)
912− | n <= maxBound `div` l = Text (A.run x) 0 len
913− | otherwise = overflowError "replicate"
909+ | n <= 0 || l <= 0 = empty
910+ | n == 1 = t
911+ | isSingleton t = replicateChar n (unsafeHead t)
912+ | n <= maxBound `quot` l = Text (A.run x) 0 len
913+ | otherwise = overflowError "replicate"
914914 where
915915 len = l * n
916916 x = do
Data/Text/Fusion/Size.hs+2−2
@@ -93,8 +93,8 @@ subtractSize _ _ = Unknown
9393
9494mul :: Int -> Int -> Int
9595mul m n
96− | m <= maxBound `div` n = m * n
97− | otherwise = overflowError
96+ | m <= maxBound `quot` n = m * n
97+ | otherwise = overflowError
9898{-# INLINE mul #-}
9999
100100mulSize :: Size -> Size -> Size
Data/Text/Lazy.hs+2−2
@@ -193,7 +193,7 @@ module Data.Text.Lazy
193193import Prelude (Char, Bool(..), Maybe(..), String,
194194 Eq(..), Ord(..), Ordering(..), Read(..), Show(..),
195195 (&&), (||), (+), (-), (.), ($), (++),
196− div, error, flip, fmap, fromIntegral, not, otherwise)
196+ error, flip, fmap, fromIntegral, not, otherwise, quot)
197197import qualified Prelude as P
198198#if defined(HAVE_DEEPSEQ)
199199import Control.DeepSeq (NFData(..))
@@ -628,7 +628,7 @@ center k c t
628628 | otherwise = replicateChar l c `append` t `append` replicateChar r c
629629 where len = length t
630630 d = k - len
631− r = d `div` 2
631+ r = d `quot` 2
632632 l = d - r
633633{-# INLINE center #-}
634634