universum 0.9.1 → 0.9.2
raw patch · 3 files changed
+69/−33 lines, 3 filesdep ~basedep ~bytestringdep ~containersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, bytestring, containers, criterion, deepseq, exceptions, ghc-prim, hashable, microlens, microlens-mtl, mtl, safe, safe-exceptions, semigroups, stm, text, text-format, transformers, type-operators, unordered-containers, utf8-string, vector
API changes (from Hackage documentation)
- Container.Class: instance Container.Class.Container Data.IntSet.Base.IntSet
- Container.Class: instance Container.Class.One (Data.IntMap.Base.IntMap v)
- Container.Class: instance Container.Class.One (Data.Map.Base.Map k v)
- Container.Class: instance Container.Class.One (Data.Sequence.Seq a)
- Container.Class: instance Container.Class.One (Data.Set.Base.Set v)
- Container.Class: instance Container.Class.One Data.IntSet.Base.IntSet
- Container.Class: instance Container.Class.ToList Data.IntSet.Base.IntSet
+ Container.Class: instance Container.Class.Container Data.IntSet.Internal.IntSet
+ Container.Class: instance Container.Class.One (Data.IntMap.Internal.IntMap v)
+ Container.Class: instance Container.Class.One (Data.Map.Internal.Map k v)
+ Container.Class: instance Container.Class.One (Data.Sequence.Internal.Seq a)
+ Container.Class: instance Container.Class.One (Data.Set.Internal.Set v)
+ Container.Class: instance Container.Class.One Data.IntSet.Internal.IntSet
+ Container.Class: instance Container.Class.ToList Data.IntSet.Internal.IntSet
+ Exceptions: Bug :: SomeException -> CallStack -> Bug
+ Exceptions: bug :: (HasCallStack, Exception e) => e -> a
+ Exceptions: data Bug
+ Exceptions: instance GHC.Exception.Exception Exceptions.Bug
+ Exceptions: instance GHC.Show.Show Exceptions.Bug
- Container.Class: and :: (Container t, Element t ~ Bool) => t -> Bool
+ Container.Class: and :: (Container t, (Element t ~ Bool)) => t -> Bool
- Container.Class: class ToList t => Container t where foldMap f = foldr (mappend . f) mempty fold = foldMap id foldr' f z0 xs = foldl f' id xs z0 where f' k x z = k $! f x z foldr1 f xs = fromMaybe (errorWithoutStackTrace "foldr1: empty structure") (foldr mf Nothing xs) where mf x m = Just (case m of { Nothing -> x Just y -> f x y }) foldl1 f xs = fromMaybe (errorWithoutStackTrace "foldl1: empty structure") (foldl mf Nothing xs) where mf m y = Just (case m of { Nothing -> y Just x -> f x y }) notElem x = not . elem x all p = getAll #. foldMap (All #. p) any p = getAny #. foldMap (Any #. p) and = getAll #. foldMap All or = getAny #. foldMap Any find p = getFirst . foldMap (\ x -> First (if p x then Just x else Nothing)) head = foldr (\ x _ -> Just x) Nothing
+ Container.Class: class ToList t => Container t
- Container.Class: class One x where type OneItem x where {
+ Container.Class: class One x where {
- Container.Class: class ToList t where null = null . toList
+ Container.Class: class ToList t
- Container.Class: or :: (Container t, Element t ~ Bool) => t -> Bool
+ Container.Class: or :: (Container t, (Element t ~ Bool)) => t -> Bool
- Lifted.Concurrent: modifyTVar' :: TVar a -> (a -> a) -> STM ()
+ Lifted.Concurrent: modifyTVar' :: () => TVar a -> (a -> a) -> STM ()
- Lifted.Concurrent: newTVar :: a -> STM (TVar a)
+ Lifted.Concurrent: newTVar :: () => a -> STM TVar a
- Lifted.Concurrent: readTVar :: TVar a -> STM a
+ Lifted.Concurrent: readTVar :: () => TVar a -> STM a
- Lifted.Concurrent: writeTVar :: TVar a -> a -> STM ()
+ Lifted.Concurrent: writeTVar :: () => TVar a -> a -> STM ()
- Monad: join :: Monad m => m (m a) -> m a
+ Monad: join :: Monad m => m m a -> m a
- TypeOps: type ($) k k1 (f :: k1 -> k) (a :: k1) = f a
+ TypeOps: type ($) k k1 (f :: k -> k1) (a :: k) = f a
Files
- CHANGES.md +8/−0
- src/Exceptions.hs +31/−3
- universum.cabal +30/−30
CHANGES.md view
@@ -1,3 +1,11 @@+0.9.2+=====++* [#114](https://github.com/serokell/universum/issues/114):+ Reexport more functions from `safe-exceptions`.+* [#100](https://github.com/serokell/universum/issues/100):+ Add `bug` function = `impureThrow`.+ 0.9.1 =====
src/Exceptions.hs view
@@ -8,17 +8,45 @@ module Exceptions ( module Control.Exception.Safe +#if ( __GLASGOW_HASKELL__ >= 800 )+ , Bug (..)+ , bug+#endif , note ) where -- exceptions from safe-exceptions-import Control.Exception.Safe (Exception, MonadCatch, MonadMask (..),- MonadThrow, SomeException (..), bracket,- bracket_, catch, catchAny, finally, throwM)+import Control.Exception.Safe (Exception (..), MonadCatch, MonadMask (..), MonadThrow,+ SomeException (..), bracket, bracketOnError, bracket_, catch,+ catchAny, displayException, finally, handleAny, mask_, onException,+ throwM, try, tryAny) import Control.Applicative (Applicative (pure)) import Control.Monad.Except (MonadError, throwError) import Data.Maybe (Maybe, maybe)++#if ( __GLASGOW_HASKELL__ >= 800 )+import Data.List ((++))+import GHC.Show (Show)+import GHC.Stack (CallStack, HasCallStack, callStack, prettyCallStack)++import qualified Control.Exception.Safe as Safe (impureThrow, toException)++-- | Type that represents exceptions used in cases when a particular codepath+-- is not meant to be ever executed, but happens to be executed anyway.+data Bug = Bug SomeException CallStack+ deriving (Show)++instance Exception Bug where+ displayException (Bug e cStack) = displayException e ++ "\n"+ ++ prettyCallStack cStack++-- | Generate a pure value which, when forced, will synchronously+-- throw the exception wrapped into 'Bug' data type.+bug :: (HasCallStack, Exception e) => e -> a+bug e = Safe.impureThrow (Bug (Safe.toException e) callStack)+#endif+ -- To suppress redundant applicative constraint warning on GHC 8.0 -- | Throws error for 'Maybe' if 'Data.Maybe.Nothing' is given.
universum.cabal view
@@ -1,5 +1,5 @@ name: universum-version: 0.9.1+version: 0.9.2 cabal-version: >=1.10 build-type: Simple license: MIT@@ -51,26 +51,26 @@ Monad.Maybe Monad.Trans build-depends:- base <5,- bytestring <0.11,- containers <0.6,- deepseq <1.5,- exceptions <0.9,- ghc-prim <0.6,- hashable <1.3,- microlens <0.5,- microlens-mtl <0.2,- mtl <2.3,- safe <0.4,- safe-exceptions <0.2,- stm <2.5,- text <1.3,- text-format <0.4,- transformers <0.6,- type-operators <0.2,- unordered-containers <0.3,- utf8-string <1.1,- vector <0.13+ base >=4.9.1.0 && <5,+ bytestring >=0.10.8.1,+ containers >=0.5.7.1,+ deepseq >=1.4.2.0,+ exceptions >=0.8.3,+ ghc-prim >=0.5.0.0,+ hashable >=1.2.6.1,+ microlens >=0.4.8.1,+ microlens-mtl >=0.1.11.0,+ mtl >=2.2.1,+ safe >=0.3.15,+ safe-exceptions >=0.1.6.0,+ stm >=2.4.4.1,+ text >=1.2.2.2,+ text-format >=0.3.1.1,+ transformers >=0.5.2.0,+ type-operators >=0.1.0.4,+ unordered-containers >=0.2.8.0,+ utf8-string >=1.0.1.1,+ vector >=0.12.0.1 default-language: Haskell2010 default-extensions: NoImplicitPrelude OverloadedStrings hs-source-dirs: src@@ -81,16 +81,16 @@ type: exitcode-stdio-1.0 main-is: Main.hs build-depends:- base <5,+ base >=4.9.1.0 && <5, universum -any,- containers <0.6,- criterion <1.2,- deepseq <1.5,- hashable <1.3,- mtl <2.3,- semigroups <0.19,- text <1.3,- unordered-containers <0.3+ containers >=0.5.7.1,+ criterion >=1.1.4.0,+ deepseq >=1.4.2.0,+ hashable >=1.2.6.1,+ mtl >=2.2.1,+ semigroups >=0.18.3,+ text >=1.2.2.2,+ unordered-containers >=0.2.8.0 default-language: Haskell2010 hs-source-dirs: benchmark ghc-options: -Wall -O2 -threaded -rtsopts -with-rtsopts=-N