packages feed

relude 1.2.2.0 → 1.2.2.1

raw patch · 16 files changed

+78/−75 lines, 16 filesnew-uploader

Files

CHANGELOG.md view
@@ -3,6 +3,12 @@ `relude` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +## 1.2.2.1 – Jul 29, 2025++- Allow containers-0.8.++- Documentation improvements+ ## 1.2.2.0 – Oct 13, 2024  - Support GHC-9.10 & GHC-9.8.
relude.cabal view
@@ -1,6 +1,6 @@ cabal-version:       3.0 name:                relude-version:             1.2.2.0+version:             1.2.2.1 synopsis:            Safe, performant, user-friendly and lightweight Haskell Standard Library description:     @__relude__@ is an alternative prelude library. If you find the default@@ -235,11 +235,11 @@     , Data.ByteString.Short  -  build-depends:       base >= 4.11 && < 4.21+  build-depends:       base >= 4.11 && < 4.22                      , bytestring >= 0.10 && < 0.13-                     , containers >= 0.5.10 && < 0.8+                     , containers >= 0.5.10 && < 0.9                      , deepseq >= 1.4 && < 1.6-                     , ghc-prim >= 0.5.0.0 && < 0.12+                     , ghc-prim >= 0.5.0.0 && < 0.14                      , hashable >= 1.2 && < 1.6                      , mtl >= 2.2 && < 2.4                      , stm >= 2.4 && < 2.6@@ -262,7 +262,7 @@                      , bytestring                      , containers                      , text-                     , hedgehog >= 1.0 && < 1.5+                     , hedgehog >= 1.0 && < 1.6    ghc-options:         -threaded @@ -273,7 +273,7 @@   main-is:             Doctest.hs    build-depends:       relude-                     , doctest >= 0.20 && < 0.23+                     , doctest >= 0.20 && < 0.25                      , Glob    ghc-options:         -threaded
src/Relude.hs view
@@ -263,7 +263,7 @@ | __"Relude.Extra.Foldable"__  | Extra folds for instances of the 'Foldable' typeclass.    | |                              | Currently, just a short-circuitable left fold.            | +------------------------------+-----------------------------------------------------------+-| __"Relude.Extra.Foldable1"__ | 'Relude.Extra.Foldable1.Foldable1' typeclass              |+| __"Relude.Extra.Foldable1"__ | t'Relude.Extra.Foldable1.Foldable1' typeclass             | |                              | like 'Foldable' but for non-empty structures.             | +------------------------------+-----------------------------------------------------------+ | __"Relude.Extra.Group"__     | Grouping functions, polymorphic on return @Map@ type.     |
src/Relude/Container/One.hs view
@@ -18,7 +18,8 @@  1. Give a shorter name for the construction: uses 'one' instead of common @singleton@. 2. Work with monomorphic structures like 'T.Text' or 'IntSet'.-3. Give a clearer and less scary name for cases where you can use 'Relude.pure' or @(:[])@.+3. Give a clearer and less scary name for cases where you can use 'Relude.Applicative.pure'+   or @(:[])@.  @since 0.1.0 -}@@ -79,13 +80,13 @@ -- Lists  {- | Allows to create a singleton list. You might prefer function with name 'one'-instead of 'Relude.pure' or @(:[])@.+instead of 'Relude.Applicative.pure' or @(:[])@.  >>> one 42 :: [Int] [42]  @-law> 'Relude.length' ('one' @[a] x) ≡ 1+law> 'Relude.Foldable.Reexport.length' ('one' @[a] x) ≡ 1 @ -} instance One [a] where@@ -96,13 +97,13 @@     {-# INLINE one #-}  {- | Allows to create singleton 'NE.NonEmpty' list. You might prefer function with-name 'one' instead of 'Relude.pure' or @(:|[])@.+name 'one' instead of 'Relude.Applicative.pure' or @(:|[])@.  >>> one 42 :: NonEmpty Int 42 :| []  @-law> 'Relude.length' ('one' @('NE.NonEmpty' a) x) ≡ 1+law> 'Relude.Foldable.Reexport.length' ('one' @('NE.NonEmpty' a) x) ≡ 1 @ -} instance One (NE.NonEmpty a) where@@ -118,7 +119,7 @@ fromList [42]  @-law> 'Relude.length' ('one' @('SEQ.Seq' a) x) ≡ 1+law> 'Relude.Foldable.Reexport.length' ('one' @('SEQ.Seq' a) x) ≡ 1 @ -} instance One (SEQ.Seq a) where@@ -218,7 +219,7 @@ fromList [(3,"foo")]  @-law> 'Relude.length' ('one' @('Map' k v) (k, v)) ≡ 1+law> 'Relude.Foldable.Reexport.length' ('one' @('Map' k v) (k, v)) ≡ 1 @ -} instance One (Map k v) where@@ -234,7 +235,7 @@ fromList [(3,"foo")]  @-law> 'Relude.length' ('one' @('HashMap' k v) (k, v)) ≡ 1+law> 'Relude.Foldable.Reexport.length' ('one' @('HashMap' k v) (k, v)) ≡ 1 @ -} instance Hashable k => One (HashMap k v) where@@ -250,7 +251,7 @@ fromList [(3,"foo")]  @-law> 'Relude.length' ('one' @('IntMap' a) x) ≡ 1+law> 'Relude.Foldable.Reexport.length' ('one' @('IntMap' a) x) ≡ 1 @ -} instance One (IntMap v) where@@ -268,7 +269,7 @@ fromList [42]  @-law> 'Relude.length' ('one' @('Set' a) x) ≡ 1+law> 'Relude.Foldable.Reexport.length' ('one' @('Set' a) x) ≡ 1 @ -} instance One (Set a) where@@ -284,7 +285,7 @@ fromList [42]  @-law> 'Relude.length' ('one' @('HashSet' a) x) ≡ 1+law> 'Relude.Foldable.Reexport.length' ('one' @('HashSet' a) x) ≡ 1 @ -} instance Hashable a => One (HashSet a) where
src/Relude/Debug.hs view
@@ -219,7 +219,7 @@ {-# WARNING traceM "'traceM' remains in code" #-}  {-|-Like 'traceM', but uses 'Relude.show' on the argument to convert it to a+Like 'traceM', but uses 'Prelude.show' on the argument to convert it to a 'String'.  >>> :{@@ -258,22 +258,9 @@ branch of code execution is not possible.  __DO NOT USE__ 'error' as a normal error handling mechanism. -#ifdef mingw32_HOST_OS->>> error "oops"-*** Exception: oops-CallStack (from HasCallStack):-  error, called at src\Relude\Debug.hs:296:11 in ...-  ...-#else->>> error "oops"-*** Exception: oops-CallStack (from HasCallStack):-  error, called at src/Relude/Debug.hs:296:11 in ...-...-#endif--⚠️__CAUTION__⚠️  Unlike "Prelude" version, 'error' takes 'Relude.Text' as an-argument. In case it used by mistake, the user will see the following:+⚠️__CAUTION__⚠️ Unlike "Prelude" version, 'error' takes+ t'Relude.String.Reexport.Text' as an argument. In case it used by mistake,+the user will see the following:  >>> error ("oops" :: String) ...
src/Relude/Extra.hs view
@@ -49,27 +49,28 @@ import Relude.Extra.Type  {- $Bifunctor-Additional combinators for 'Relude.Bifunctor'.+Additional combinators for t'Relude.Functor.Reexport.Bifunctor'. -}  {- $CallStack-Useful functions to extract information from 'Relude.CallStack'.+Useful functions to extract information from t'Relude.Base.CallStack'. -} {- $Enum-Extra utilities for types that implement 'Relude.Bounded' and 'Relude.Enum'+Extra utilities for types that implement t'Relude.Enum.Bounded' and t'Relude.Enum.Enum' constraints. -} {- $Foldable-Extra folds for instances of the 'Relude.Foldable' typeclass.+Extra folds for instances of the t'Relude.Foldable.Reexport.Foldable' typeclass. Currently, just a short-circuitable left fold 'foldlSC'. -}  {- $Foldable1-'Foldable1' is a typeclass like 'Relude.Foldable' but for non-empty structures.-For example, 'Relude.NonEmpty', 'Relude.Identity'.+'Foldable1' is a typeclass like t'Relude.Foldable.Reexport.Foldable' but for non-empty+structures.  For example, t'Relude.List.NonEmpty.NonEmpty',+'Relude.Functor.Reexport.Identity'.  'Foldable1' has all type-safe and total methods like `head1`, `maximum1` in-contradiction with 'Data.Foldable.Foldable'.+contradiction with t'Relude.Foldable.Reexport.Foldable'. -}  {- $Group
src/Relude/Extra/Tuple.hs view
@@ -119,7 +119,7 @@ mapToFst :: (a -> b) -> a -> (b, a) mapToFst = toFst {-# INLINE mapToFst #-}-{-# DEPRECATED mapToFst "Use 'toFst' from 'Relude.Extra.Tuple' instead" #-}+{-# DEPRECATED mapToFst "Use 'toFst' from [Tuple](\"Relude.Extra.Tuple\") instead" #-}  {- | Apply a function, with the result in the second slot, and the value in the other.@@ -134,7 +134,7 @@ mapToSnd :: (a -> b) -> a -> (a, b) mapToSnd = toSnd {-# INLINE mapToSnd #-}-{-# DEPRECATED mapToSnd "Use 'toSnd' from 'Relude.Extra.Tuple' instead" #-}+{-# DEPRECATED mapToSnd "Use 'toSnd' from [Tuple](\"Relude.Extra.Tuple\") instead" #-}  {- | Apply a function that returns a value inside of a functor, with the output in the first slot, the input in the second,
src/Relude/Foldable/Fold.hs view
@@ -79,7 +79,7 @@ flipfoldl' f = foldl' (flip f) {-# INLINE flipfoldl' #-} -{- | Alternative version of 'Relude.asum' that takes a function to map over.+{- | Alternative version of 'Relude.Foldable.Reexport.asum' that takes a function to map over.  >>> asumMap (\x -> if x > 2 then Just x else Nothing) [1..4] Just 3@@ -90,7 +90,7 @@ asumMap = coerce (foldMap :: (a -> Alt m b) -> f a -> Alt m b) {-# INLINE asumMap #-} -{- | Polymorphic version of the 'Relude.concatMapA' function.+{- | Polymorphic version of the 'concatMapA' function.  >>> foldMapA @[Int] (Just . replicate 3) [1..3] Just [1,1,1,2,2,2,3,3,3]@@ -105,7 +105,7 @@ foldMapA = coerce (foldMap :: (a -> Ap m b) -> f a -> Ap m b) {-# INLINE foldMapA #-} -{- | Polymorphic version of the 'Relude.concatMapM' function.+{- | Polymorphic version of the 'Control.Monad.Extra.concatMapM' function.  >>> foldMapM @[Int] (Just . replicate 3) [1..3] Just [1,1,1,2,2,2,3,3,3]
src/Relude/Functor/Reexport.hs view
@@ -15,13 +15,16 @@ -}  module Relude.Functor.Reexport-    ( module Data.Bifunctor-    , module Data.Functor+    ( -- * Reexport Functor+      module Data.Functor     , module Data.Functor.Compose     , module Data.Functor.Identity #if MIN_VERSION_base(4,12,0)     , module Data.Functor.Contravariant #endif++      -- * Reexport Bifunctor+    , module Data.Bifunctor     ) where  import Data.Bifunctor (Bifunctor (..))
src/Relude/Lifted.hs view
@@ -13,48 +13,49 @@ Lifted versions of base functions.  These functions are lifted in a sense that you can use them inside various-monad transformers without adding 'Relude.liftIO' calls explicitly. However, you still-can use all these functions inside plain 'Relude.IO' monad as usual.+monad transformers without adding 'Relude.Monad.Reexport.liftIO' calls+explicitly. However, you still can use all these functions inside plain+ t'Relude.Base.IO' monad as usual.  === Example  ==== @base@  With the @base@ function, you can easily work with these functions in the-'Relude.IO' monad:+ t'Relude.Base.IO' monad:  @-__main__ :: 'Relude.IO' ()+__main__ :: t'Relude.Base.IO' () __main__ = __do__     x <- 'Data.Text.getLine'     'Prelude.print' x @ -However, to work in 'Relude.MonadIO' you already need to "lift" them:+However, to work in t'Relude.Monad.Reexport.MonadIO' you already need to "lift" them:  @-__main__ :: 'Relude.MonadIO' m => m ()+__main__ :: t'Relude.Monad.Reexport.MonadIO' m => m () __main__ = __do__-    x <- 'Relude.liftIO' 'Data.Text.getLine'-    'Relude.liftIO' ('Prelude.print' x)+    x <- 'Relude.Monad.Reexport.liftIO' 'Data.Text.getLine'+    'Relude.Monad.Reexport.liftIO' ('Prelude.print' x) @  ==== @relude@ -In the meantime, @relude@ provides these function that can work in 'Relude.IO'+In the meantime, @relude@ provides these function that can work in t'Relude.Base.IO' the same way:  @-__main__ :: 'Relude.IO' ()+__main__ :: t'Relude.Base.IO' () __main__ = __do__     x <- 'getLine'     'print' x @ -But also allows you to work in the 'Relude.MonadIO' monads more easily:+But also allows you to work in the t'Relude.Monad.Reexport.MonadIO' monads more easily:  @-__main__ :: 'Relude.MonadIO' m => m ()+__main__ :: t'Relude.Monad.Reexport.MonadIO' m => m () __main__ = __do__     x <- 'getLine'     'print' x@@ -93,7 +94,7 @@ Lifted versions of functions that work with exit processes. -} {- $file-Lifted versions of functions working with files and common 'Relude.IO'.+Lifted versions of functions working with files and common t'Relude.Base.IO'. -} {- $ioref Lifted reexports from "Data.IORef" module.@@ -102,7 +103,7 @@ Lifted functions to work with stdin and stdout. -} {- $handle-Lifted functions to work with 'Relude.Base.IO' 'Handle's.+Lifted functions to work with t'Relude.Base.IO' 'Handle's. -} {- $env Lifted functions to work with system environment.
src/Relude/Monad.hs view
@@ -80,10 +80,10 @@ Reexports functions to work with different monads. -} {- $maybe-Provided new combinators to work with 'Relude.Maybe' data type.+Provided new combinators to work with 'Relude.Monad.Reexport.Maybe' data type. -} {- $either-Provided new combinators to work with 'Relude.Either' data type.+Provided new combinators to work with 'Relude.Monad.Reexport.Either' data type. -} {- $trans Monad transformers functions and combinators.
src/Relude/Monad/Either.hs view
@@ -12,7 +12,7 @@ Stability               : Stable Portability             : Portable -Utilities to work with 'Relude.Either' data type.+Utilities to work with 'Relude.Monad.Reexport.Either' data type. -}  module Relude.Monad.Either
src/Relude/Monad/Maybe.hs view
@@ -10,7 +10,7 @@ Stability               : Stable Portability             : Portable -Utility functions to work with 'Relude.Maybe' data type as monad.+Utility functions to work with 'Relude.Monad.Reexport.Maybe' data type as monad. -}  module Relude.Monad.Maybe@@ -49,7 +49,7 @@ mA ?: b = fromMaybe b mA {-# INLINE (?:) #-} -{- | Specialized version of 'Relude.for_' for 'Maybe'. It's used for code readability.+{- | Specialized version of 'Relude.Foldable.Reexport.for_' for 'Maybe'. It's used for code readability.  Also helps to avoid space leaks: <http://www.snoyman.com/blog/2017/01/foldable-mapm-maybe-and-recursive-functions Foldable.mapM_ space leak>.
src/Relude/Monad/Reexport.hs view
@@ -14,13 +14,16 @@ -}  module Relude.Monad.Reexport-    ( -- * Reexport transformers-      module Control.Monad.Except+    ( -- * Reexport MonadIO+      module Control.Monad.IO.Class++      -- * Reexport transformers+    , module Control.Monad.Except     , module Control.Monad.Reader     , module Control.Monad.State.Strict     , module Control.Monad.Trans     , module Control.Monad.Trans.Identity-    , module Control.Monad.Trans.Maybe+    , module Control.Monad.Trans.Maybe         -- * Reexport monadic functions     , module Control.Monad@@ -34,13 +37,14 @@     ) where  -- Monad transformers+import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.Except (ExceptT (..), runExceptT) import Control.Monad.Reader (MonadReader, Reader, ReaderT (..), ask, asks, local, reader, runReader,                              withReader, withReaderT) import Control.Monad.State.Strict (MonadState, State, StateT (..), evalState, evalStateT, execState,                                    execStateT, get, gets, modify, modify', put, runState, state,                                    withState)-import Control.Monad.Trans (MonadIO, MonadTrans, lift, liftIO)+import Control.Monad.Trans (MonadTrans, lift) import Control.Monad.Trans.Identity (IdentityT (runIdentityT)) import Control.Monad.Trans.Maybe (MaybeT (..), exceptToMaybeT, maybeToExceptT) 
src/Relude/Monoid.hs view
@@ -62,7 +62,7 @@ -- >>> import Relude.Monad (Maybe (..)) -- >>> import Relude.Numeric (Int) -{- | Extracts 'Monoid' value from 'Maybe' returning 'mempty' if 'Relude.Nothing'.+{- | Extracts 'Monoid' value from 'Maybe' returning 'mempty' if 'Relude.Monad.Reexport.Nothing'.  >>> maybeToMonoid (Just [1,2,3] :: Maybe [Int]) [1,2,3]
src/Relude/Unsafe.hs view
@@ -18,9 +18,9 @@ +-----------------------------------+---------------------------------------------------------------------+ | __Partial__                       | __Total__                                                           | +===================================+=====================================================================+-| @'head' :: [a] -> a@              | @'Relude.head' :: NonEmpty a -> a@                                  |+| @'head' :: [a] -> a@              | @'Relude.List.NonEmpty.head' :: NonEmpty a -> a@                    | +-----------------------------------+---------------------------------------------------------------------+-| @'tail' :: [a] -> [a]@            | @'Relude.tail' :: NonEmpty a -> [a]@                                |+| @'tail' :: [a] -> [a]@            | @'Relude.List.NonEmpty.tail' :: NonEmpty a -> [a]@                  | +-----------------------------------+---------------------------------------------------------------------+ | @'read' :: Read a => String -> a@ | @'Relude.String.Reexport.readMaybe' :: Read a => String -> Maybe a@ | +-----------------------------------+---------------------------------------------------------------------+