packages feed

universum 0.4.3 → 0.5

raw patch · 7 files changed

+51/−21 lines, 7 files

Files

CHANGES.md view
@@ -1,3 +1,13 @@+0.5+=====++* Export `MonadTrans` typeclass.+* Remove `Symbol`-related exports from `GHC.TypeLits`.+* Remove `SrcLoc` and `Location` reexports from `GHC.ExecutionStack`.+* Add `With` type operator.+* Add `hashNub`.+* Export strict `StateT` instead of lazy.+ 0.4.3 ===== 
src/Base.hs view
@@ -44,11 +44,8 @@   #if ( __GLASGOW_HASKELL__ >= 800 )+import           GHC.ExecutionStack   (getStackTrace, showStackTrace) import           GHC.OverloadedLabels (IsLabel (..))--import           GHC.ExecutionStack   (Location (..), SrcLoc (..), getStackTrace,-                                       showStackTrace)- import           GHC.Stack            (CallStack, HasCallStack, callStack,                                        currentCallStack, getCallStack, prettyCallStack,                                        prettySrcLoc, withFrozenCallStack)
src/List.hs view
@@ -5,6 +5,7 @@  module List        ( list+       , hashNub        , ordNub        , sortBy        , sortOn@@ -19,7 +20,10 @@        , zip3        ) where +import           Data.Eq             (Eq) import           Data.Functor        (fmap)+import           Data.Hashable       (Hashable)+import           Data.HashSet        as HS import           Data.List           (sortBy, sortOn, unzip, unzip3, zip, zip3) import           Data.Ord            (Ord) import qualified Data.Set            as Set@@ -42,6 +46,16 @@       if x `Set.member` s       then go s xs       else x : go (Set.insert x s) xs++-- | Like 'Prelude.nub' but runs in @O(n * log_16(n))@ time and requires 'Hashable'.+hashNub :: (Eq a, Hashable a) => [a] -> [a]+hashNub l = go HS.empty l+  where+    go _ []     = []+    go s (x:xs) =+      if x `HS.member` s+      then go s xs+      else x : go (HS.insert x s) xs  -- | Returns default list if given list is empty. -- Otherwise applies given function to every element.
src/Monad/Trans.hs view
@@ -7,7 +7,7 @@          module Control.Monad.Catch        , module Control.Monad.Except        , module Control.Monad.Reader-       , module Control.Monad.State+       , module Control.Monad.State.Strict        , module Control.Monad.Trans        , module Control.Monad.Trans.Maybe @@ -25,19 +25,19 @@        ) where  -- Monad transformers-import           Control.Monad.Catch       (MonadCatch (catch), MonadMask (..),-                                            MonadThrow (throwM), bracket, bracket_,-                                            catchAll, finally)-import           Control.Monad.Except      (ExceptT (..), runExceptT)-import           Control.Monad.Reader      (MonadReader, Reader, ReaderT (..), ask, asks,-                                            local, reader, runReader)-import           Control.Monad.State       (MonadState, State, StateT (..), evalState,-                                            evalStateT, execState, execStateT, gets,-                                            modify, runState, state, withState)-import           Control.Monad.Trans       (MonadIO, lift, liftIO)-import           Control.Monad.Trans.Maybe (MaybeT (..), exceptToMaybeT, maybeToExceptT)+import           Control.Monad.Catch        (MonadCatch (catch), MonadMask (..),+                                             MonadThrow (throwM), bracket, bracket_,+                                             catchAll, finally)+import           Control.Monad.Except       (ExceptT (..), runExceptT)+import           Control.Monad.Reader       (MonadReader, Reader, ReaderT (..), ask, asks,+                                             local, reader, runReader)+import           Control.Monad.State.Strict (MonadState, State, StateT (..), evalState,+                                             evalStateT, execState, execStateT, gets,+                                             modify, runState, state, withState)+import           Control.Monad.Trans        (MonadIO, MonadTrans, lift, liftIO)+import           Control.Monad.Trans.Maybe  (MaybeT (..), exceptToMaybeT, maybeToExceptT) -import           Prelude                   (Functor, flip, fst, snd, (<$>))+import           Prelude                    (Functor, flip, fst, snd, (<$>))  -- | Shorter and more readable alias for @flip runReaderT@. usingReaderT :: r -> ReaderT r m a -> m a
src/TypeOps.hs view
@@ -18,6 +18,7 @@  module TypeOps        ( type Each+       , type With        , type ($)        ) where @@ -46,3 +47,13 @@ type family Each (c :: [k -> Constraint]) (as :: [k]) where     Each c '[] = (() :: Constraint)     Each c (h ': t) = (c <+> h, Each c t)++-- | Map several constraints over a single variable.+-- Note, that @With a b ≡ Each a '[b]@+--+-- @+-- a :: With [Show, Read] a => a -> a+-- =+-- a :: (Show a, Read a) => a -> a+-- @+type With a b = a <+> b
src/Universum.hs view
@@ -143,9 +143,7 @@ import           GHC.Generics             as X (Generic) #if ( __GLASGOW_HASKELL__ >= 710 ) import           GHC.TypeLits             as X (CmpNat, KnownNat, KnownSymbol, Nat,-                                                SomeNat (..), SomeSymbol (..), Symbol,-                                                natVal, someNatVal, someSymbolVal,-                                                symbolVal)+                                                SomeNat (..), natVal, someNatVal) #endif  -- Buildable
universum.cabal view
@@ -1,5 +1,5 @@ name:                universum-version:             0.4.3+version:             0.5 synopsis:            Custom prelude used in Serokell description:         Custom prelude used in Serokell homepage:            https://github.com/serokell/universum