extra 1.4.1 → 1.4.2
raw patch · 4 files changed
+14/−9 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.List.Extra: instance Show Color
- Data.List.Extra: instance Show a => Show (RB a)
- System.Time.Extra: instance Eq Timeout
- System.Time.Extra: instance Exception Timeout
- System.Time.Extra: instance Show Timeout
- System.Time.Extra: instance Typeable Timeout
+ Data.List.Extra: instance GHC.Show.Show Data.List.Extra.Color
+ Data.List.Extra: instance GHC.Show.Show a => GHC.Show.Show (Data.List.Extra.RB a)
+ System.Time.Extra: instance GHC.Classes.Eq System.Time.Extra.Timeout
+ System.Time.Extra: instance GHC.Exception.Exception System.Time.Extra.Timeout
+ System.Time.Extra: instance GHC.Show.Show System.Time.Extra.Timeout
Files
- CHANGES.txt +2/−0
- extra.cabal +1/−1
- src/Control/Monad/Extra.hs +9/−6
- src/System/IO/Extra.hs +2/−2
CHANGES.txt view
@@ -1,5 +1,7 @@ Changelog for Extra +1.4.2+ Make concatMapM/mapMaybeM faster 1.4.1 Make temp file functions workaround GHC bug #10731 Add retryBool
extra.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.10 build-type: Simple name: extra-version: 1.4.1+version: 1.4.2 license: BSD3 license-file: LICENSE category: Development
src/Control/Monad/Extra.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP #-}+{-# LANGUAGE UnboxedTuples #-} -- | Extra functions for "Control.Monad". -- These functions provide looping, list operations and booleans.@@ -13,14 +13,13 @@ -- * Lists partitionM, concatMapM, mapMaybeM, findM, firstJustM, -- * Booleans- whenM, unlessM, ifM, notM, (||^), (&&^), orM, andM, anyM, allM,+ whenM, unlessM, ifM, notM, (||^), (&&^), orM, andM, anyM, allM ) where import Control.Monad-#if __GLASGOW_HASKELL__ < 709 import Control.Applicative-#endif import Data.Maybe+import Prelude -- General utilities @@ -58,11 +57,15 @@ -- | A version of 'concatMap' that works with a monadic predicate. concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b]-concatMapM f = liftM concat . mapM f+{-# INLINE concatMapM #-}+concatMapM op = foldr f (return [])+ where f x xs = do x <- op x; if null x then xs else do xs <- xs; return $ x++xs -- | A version of 'mapMaybe' that works with a monadic predicate. mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b]-mapMaybeM f = liftM catMaybes . mapM f+{-# INLINE mapMaybeM #-}+mapMaybeM op = foldr f (return [])+ where f x xs = do x <- op x; case x of Nothing -> xs; Just x -> do xs <- xs; return $ x:xs -- Looping
src/System/IO/Extra.hs view
@@ -127,7 +127,7 @@ hSetBuffering out buf --- | Execute an action with a custom 'BufferMode', a warpper around+-- | Execute an action with a custom 'BufferMode', a wrapper around -- 'hSetBuffering'. withBuffering :: Handle -> BufferMode -> IO a -> IO a withBuffering h m act = bracket (hGetBuffering h) (hSetBuffering h) $ const $ do@@ -141,7 +141,7 @@ {-# NOINLINE tempRef #-} tempRef :: IORef Int tempRef = unsafePerformIO $ do- rand :: Integer <- fmap (read . take 50 . filter isDigit . show . utctDayTime) getCurrentTime+ rand :: Integer <- fmap (read . reverse . filter isDigit . show . utctDayTime) getCurrentTime newIORef $ fromIntegral rand tempUnique :: IO Int