packages feed

extra 1.6.13 → 1.6.14

raw patch · 10 files changed

+40/−10 lines, 10 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- System.Time.Extra: instance GHC.Exception.Exception System.Time.Extra.Timeout
+ Data.Either.Extra: mapLeft :: (a -> c) -> Either a b -> Either c b
+ Data.Either.Extra: mapRight :: (b -> c) -> Either a b -> Either a c
+ Data.Typeable.Extra: infix 4 :~:
+ Extra: infix 4 :~:
+ Extra: mapLeft :: (a -> c) -> Either a b -> Either c b
+ Extra: mapRight :: (b -> c) -> Either a b -> Either a c
+ System.Time.Extra: instance GHC.Exception.Type.Exception System.Time.Extra.Timeout
- Control.Concurrent.Extra: forkFinally :: () => IO a -> Either SomeException a -> IO () -> IO ThreadId
+ Control.Concurrent.Extra: forkFinally :: () => IO a -> (Either SomeException a -> IO ()) -> IO ThreadId
- Data.IORef.Extra: atomicModifyIORef' :: () => IORef a -> a -> (a, b) -> IO b
+ Data.IORef.Extra: atomicModifyIORef' :: () => IORef a -> (a -> (a, b)) -> IO b
- Data.IORef.Extra: modifyIORef' :: () => IORef a -> a -> a -> IO ()
+ Data.IORef.Extra: modifyIORef' :: () => IORef a -> (a -> a) -> IO ()
- Data.List.Extra: dropWhileEnd :: () => a -> Bool -> [a] -> [a]
+ Data.List.Extra: dropWhileEnd :: () => (a -> Bool) -> [a] -> [a]
- Data.List.Extra: sortOn :: Ord b => a -> b -> [a] -> [a]
+ Data.List.Extra: sortOn :: Ord b => (a -> b) -> [a] -> [a]
- Data.Tuple.Extra: uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d)
+ Data.Tuple.Extra: uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
- Data.Typeable.Extra: [Refl] :: a :~: a
+ Data.Typeable.Extra: [Refl] :: forall k (a :: k) (b :: k). () => a :~: a
- Data.Typeable.Extra: data Proxy (t :: k) :: forall k. () => k -> *
+ Data.Typeable.Extra: data Proxy (t :: k) :: forall k. () => k -> Type
- Extra: [Refl] :: a :~: a
+ Extra: [Refl] :: forall k (a :: k) (b :: k). () => a :~: a
- Extra: atomicModifyIORef' :: () => IORef a -> a -> (a, b) -> IO b
+ Extra: atomicModifyIORef' :: () => IORef a -> (a -> (a, b)) -> IO b
- Extra: data Proxy (t :: k) :: forall k. () => k -> *
+ Extra: data Proxy (t :: k) :: forall k. () => k -> Type
- Extra: dropWhileEnd :: () => a -> Bool -> [a] -> [a]
+ Extra: dropWhileEnd :: () => (a -> Bool) -> [a] -> [a]
- Extra: forkFinally :: () => IO a -> Either SomeException a -> IO () -> IO ThreadId
+ Extra: forkFinally :: () => IO a -> (Either SomeException a -> IO ()) -> IO ThreadId
- Extra: lookupEnv :: String -> IO Maybe String
+ Extra: lookupEnv :: String -> IO (Maybe String)
- Extra: modifyIORef' :: () => IORef a -> a -> a -> IO ()
+ Extra: modifyIORef' :: () => IORef a -> (a -> a) -> IO ()
- Extra: sortOn :: Ord b => a -> b -> [a] -> [a]
+ Extra: sortOn :: Ord b => (a -> b) -> [a] -> [a]
- Extra: uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d)
+ Extra: uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
- System.Environment.Extra: lookupEnv :: String -> IO Maybe String
+ System.Environment.Extra: lookupEnv :: String -> IO (Maybe String)

Files

CHANGES.txt view
@@ -1,5 +1,7 @@ Changelog for Extra +1.6.14, released 2018-12-10+    Add mapLeft and mapRight 1.6.13, released 2018-10-14     #40, deprecate Data.List.Extra.for (clashes with Traversable) 1.6.12, released 2018-09-24
extra.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.18 build-type:         Simple name:               extra-version:            1.6.13+version:            1.6.14 license:            BSD3 license-file:       LICENSE category:           Development@@ -15,7 +15,7 @@     The module "Extra" documents all functions provided by this library. Modules such as "Data.List.Extra" provide extra functions over "Data.List" and also reexport "Data.List". Users are recommended to replace "Data.List" imports with "Data.List.Extra" if they need the extra functionality. homepage:           https://github.com/ndmitchell/extra#readme bug-reports:        https://github.com/ndmitchell/extra/issues-tested-with:        GHC==8.6.1, GHC==8.4.3, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2+tested-with:        GHC==8.6.3, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2  extra-doc-files:     CHANGES.txt
src/Control/Concurrent/Extra.hs view
@@ -5,13 +5,13 @@ -- --   This module includes three new types of 'MVar', namely 'Lock' (no associated value), --   'Var' (never empty) and 'Barrier' (filled at most once). See---   <http://neilmitchell.blogspot.co.uk/2012/06/flavours-of-mvar_04.html this blog post>+--   <httpd://neilmitchell.blogspot.co.uk/2012/06/flavours-of-mvar_04.html this blog post> --   for examples and justification. -- --   If you need greater control of exceptions and threads---   see the <http://hackage.haskell.org/package/slave-thread slave-thread> package.+--   see the <https://hackage.haskell.org/package/slave-thread slave-thread> package. --   If you need elaborate relationships between threads---   see the <http://hackage.haskell.org/package/async async> package.+--   see the <httdp://hackage.haskell.org/package/async async> package. module Control.Concurrent.Extra(     module Control.Concurrent,     getNumCapabilities, setNumCapabilities, withNumCapabilities,
src/Control/Exception/Extra.hs view
@@ -4,6 +4,9 @@ -- | Extra functions for "Control.Exception". --   These functions provide retrying, showing in the presence of exceptions, --   and functions to catch\/ignore exceptions, including monomorphic (no 'Exception' context) versions.+--+--   If you want to use a safer set of exceptions see the+--   <https://hackage.haskell.org/package/safe-exceptions safe-exceptions> package. module Control.Exception.Extra(     module Control.Exception,     Partial,
src/Control/Monad/Extra.hs view
@@ -3,7 +3,7 @@ -- | Extra functions for "Control.Monad". --   These functions provide looping, list operations and booleans. --   If you need a wider selection of monad loops and list generalisations,---   see <http://hackage.haskell.org/package/monad-loops monad-loops>.+--   see <https://hackage.haskell.org/package/monad-loops monad-loops>. module Control.Monad.Extra(     module Control.Monad,     whenJust, whenJustM,
src/Data/Either/Extra.hs view
@@ -4,11 +4,15 @@ -- | This module extends "Data.Either" with extra operations, particularly --   to quickly extract from inside an 'Either'. Some of these operations are --   partial, and should be used with care in production-quality code.+--+--   If you need more 'Either' functions see the+--   <https://hackage.haskell.org/package/either either>. module Data.Either.Extra(     module Data.Either,     isLeft, isRight, fromLeft, fromRight, fromEither,     fromLeft', fromRight',     eitherToMaybe, maybeToEither,+    mapLeft, mapRight,     ) where  import Data.Either@@ -93,3 +97,20 @@ -- > \x -> eitherToMaybe (Right x) == Just x eitherToMaybe :: Either a b -> Maybe b eitherToMaybe = either (const Nothing) Just+++-- | The 'mapLeft' function takes a function and applies it to an Either value+-- iff the value takes the form @'Left' _@.+--+-- > mapLeft show (Left 1) == Left "1"+-- > mapLeft show (Right True) == Right True+mapLeft :: (a -> c) -> Either a b -> Either c b+mapLeft f = either (Left . f) Right++-- | The 'mapRight' function takes a function and applies it to an Either value+-- iff the value takes the form @'Right' _@.+--+-- > mapRight show (Left 1) == Left 1+-- > mapRight show (Right True) == Right "True"+mapRight :: (b -> c) -> Either a b -> Either a c+mapRight = fmap
src/Data/List/Extra.hs view
@@ -4,7 +4,7 @@ -- | This module extends "Data.List" with extra functions of a similar nature. --   The package also exports the existing "Data.List" functions. --   Some of the names and semantics were inspired by the---   <http://hackage.haskell.org/package/text text> package.+--   <https://hackage.haskell.org/package/text text> package. module Data.List.Extra(     module Data.List,     -- * String operations@@ -708,7 +708,7 @@  --------------------------------------------------------------------- -- OKASAKI RED BLACK TREE--- Taken from http://www.cs.kent.ac.uk/people/staff/smk/redblack/Untyped.hs+-- Taken from https://www.cs.kent.ac.uk/people/staff/smk/redblack/Untyped.hs  data Color = R | B deriving Show data RB a = E | T Color (RB a) a (RB a) deriving Show
src/Extra.hs view
@@ -17,7 +17,7 @@     whenJust, whenJustM, whenMaybe, whenMaybeM, unit, maybeM, eitherM, loop, loopM, whileM, partitionM, concatMapM, concatForM, mconcatMapM, mapMaybeM, findM, firstJustM, fold1M, fold1M_, whenM, unlessM, ifM, notM, (||^), (&&^), orM, andM, anyM, allM,     -- * Data.Either.Extra     -- | Extra functions available in @"Data.Either.Extra"@.-    isLeft, isRight, fromLeft, fromRight, fromEither, fromLeft', fromRight', eitherToMaybe, maybeToEither,+    isLeft, isRight, fromLeft, fromRight, fromEither, fromLeft', fromRight', eitherToMaybe, maybeToEither, mapLeft, mapRight,     -- * Data.IORef.Extra     -- | Extra functions available in @"Data.IORef.Extra"@.     modifyIORef', writeIORef', atomicModifyIORef', atomicWriteIORef, atomicWriteIORef',
src/System/IO/Extra.hs view
@@ -3,7 +3,7 @@ -- | More IO functions. The functions include ones for reading files with specific encodings, --   strictly reading files, and writing files with encodings. There are also some simple --   temporary file functions, more advanced alternatives can be found in---   the <http://hackage.haskell.org/package/exceptions exceptions> package.+--   the <https://hackage.haskell.org/package/exceptions exceptions> package. module System.IO.Extra(     module System.IO,     captureOutput,
test/TestGen.hs view
@@ -68,6 +68,10 @@     testGen "\\a -> maybeToEither a Nothing == Left a" $ \a -> maybeToEither a Nothing == Left a     testGen "\\x -> eitherToMaybe (Left x) == Nothing" $ \x -> eitherToMaybe (Left x) == Nothing     testGen "\\x -> eitherToMaybe (Right x) == Just x" $ \x -> eitherToMaybe (Right x) == Just x+    testGen "mapLeft show (Left 1) == Left \"1\"" $ mapLeft show (Left 1) == Left "1"+    testGen "mapLeft show (Right True) == Right True" $ mapLeft show (Right True) == Right True+    testGen "mapRight show (Left 1) == Left 1" $ mapRight show (Left 1) == Left 1+    testGen "mapRight show (Right True) == Right \"True\"" $ mapRight show (Right True) == Right "True"     testGen "\\xs -> repeatedly (splitAt 3) xs  == chunksOf 3 xs" $ \xs -> repeatedly (splitAt 3) xs  == chunksOf 3 xs     testGen "\\xs -> repeatedly word1 (trim xs) == words xs" $ \xs -> repeatedly word1 (trim xs) == words xs     testGen "\\xs -> repeatedly line1 xs == lines xs" $ \xs -> repeatedly line1 xs == lines xs