relude 1.0.0.1 → 1.1.0.0
raw patch · 62 files changed
+558/−415 lines, 62 filesdep +tasty-benchdep −criteriondep ~basedep ~containersdep ~doctestPVP ok
version bump matches the API change (PVP)
Dependencies added: tasty-bench
Dependencies removed: criterion
Dependency ranges changed: base, containers, doctest, ghc-prim, hashable, hedgehog, text, transformers
API changes (from Hackage documentation)
- Relude.Lifted.File: readFile' :: MonadIO m => FilePath -> m String
- Relude.Monoid: Option :: Maybe a -> Option a
- Relude.Monoid: [getOption] :: Option a -> Maybe a
- Relude.Monoid: newtype Option a
- Relude.Base: coerce :: forall {k :: RuntimeRep} (a :: TYPE k) (b :: TYPE k). Coercible a b => a -> b
+ Relude.Base: coerce :: forall (k :: RuntimeRep) (a :: TYPE k) (b :: TYPE k). Coercible a b => a -> b
- Relude.Base: seq :: forall {r :: RuntimeRep} a (b :: TYPE r). a -> b -> b
+ Relude.Base: seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b
- Relude.Container.Reexport: class Hashable a
+ Relude.Container.Reexport: class Eq a => Hashable a
- Relude.Function: (<<<) :: forall {k} cat (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c
+ Relude.Function: (<<<) :: forall k cat (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c
- Relude.Function: (>>>) :: forall {k} cat (a :: k) (b :: k) (c :: k). Category cat => cat a b -> cat b c -> cat a c
+ Relude.Function: (>>>) :: forall k cat (a :: k) (b :: k) (c :: k). Category cat => cat a b -> cat b c -> cat a c
- Relude.Functor.Reexport: contramap :: Contravariant f => (a' -> a) -> f a -> f a'
+ Relude.Functor.Reexport: contramap :: Contravariant f => (a -> b) -> f b -> f a
- Relude.Nub: hashNub :: forall a. (Eq a, Hashable a) => [a] -> [a]
+ Relude.Nub: hashNub :: forall a. Hashable a => [a] -> [a]
- Relude.Nub: unstableNub :: (Eq a, Hashable a) => [a] -> [a]
+ Relude.Nub: unstableNub :: Hashable a => [a] -> [a]
Files
- CHANGELOG.md +27/−0
- README.md +27/−14
- benchmark/Main.hs +1/−2
- relude.cabal +21/−17
- src/Relude.hs +8/−7
- src/Relude/Applicative.hs +8/−7
- src/Relude/Base.hs +9/−8
- src/Relude/Bool.hs +8/−7
- src/Relude/Bool/Guard.hs +8/−7
- src/Relude/Bool/Reexport.hs +8/−7
- src/Relude/Container.hs +8/−7
- src/Relude/Container/One.hs +8/−7
- src/Relude/Container/Reexport.hs +8/−7
- src/Relude/Debug.hs +10/−9
- src/Relude/DeepSeq.hs +8/−7
- src/Relude/Enum.hs +9/−6
- src/Relude/Exception.hs +8/−7
- src/Relude/Extra.hs +6/−5
- src/Relude/Extra/Bifunctor.hs +6/−5
- src/Relude/Extra/CallStack.hs +6/−5
- src/Relude/Extra/Enum.hs +6/−5
- src/Relude/Extra/Foldable.hs +6/−5
- src/Relude/Extra/Foldable1.hs +7/−6
- src/Relude/Extra/Group.hs +6/−5
- src/Relude/Extra/Lens.hs +7/−7
- src/Relude/Extra/Map.hs +6/−5
- src/Relude/Extra/Newtype.hs +6/−5
- src/Relude/Extra/Tuple.hs +6/−5
- src/Relude/Extra/Type.hs +19/−7
- src/Relude/File.hs +17/−5
- src/Relude/Foldable.hs +6/−5
- src/Relude/Foldable/Fold.hs +8/−7
- src/Relude/Foldable/Reexport.hs +6/−5
- src/Relude/Function.hs +8/−7
- src/Relude/Functor.hs +8/−7
- src/Relude/Functor/Fmap.hs +8/−7
- src/Relude/Functor/Reexport.hs +8/−7
- src/Relude/Lifted.hs +8/−8
- src/Relude/Lifted/Concurrent.hs +8/−7
- src/Relude/Lifted/Env.hs +8/−5
- src/Relude/Lifted/Exit.hs +8/−7
- src/Relude/Lifted/File.hs +10/−7
- src/Relude/Lifted/Handle.hs +8/−5
- src/Relude/Lifted/IORef.hs +8/−7
- src/Relude/Lifted/Terminal.hs +6/−5
- src/Relude/List.hs +8/−7
- src/Relude/List/NonEmpty.hs +8/−7
- src/Relude/List/Reexport.hs +8/−7
- src/Relude/Monad.hs +8/−7
- src/Relude/Monad/Either.hs +8/−7
- src/Relude/Monad/Maybe.hs +8/−7
- src/Relude/Monad/Reexport.hs +8/−7
- src/Relude/Monad/Trans.hs +9/−8
- src/Relude/Monoid.hs +10/−9
- src/Relude/Nub.hs +25/−15
- src/Relude/Numeric.hs +6/−5
- src/Relude/Print.hs +8/−7
- src/Relude/String.hs +8/−8
- src/Relude/String/Conversion.hs +14/−7
- src/Relude/String/Reexport.hs +8/−7
- src/Relude/Unsafe.hs +8/−7
- test/Doctest.hs +2/−1
CHANGELOG.md view
@@ -3,6 +3,33 @@ `relude` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +## 1.1.0.0 — Jun 9, 2022++* [#388](https://github.com/kowainik/relude/issues/388):+ Support GHC-9.2.+* [#363](https://github.com/kowainik/relude/issues/363):+ Remove the `Option` type, reexported from `Data.Semigroup`+ (which was removed in `base-4.16`, GHC 9.2)++ **Migration guide:** Use `Maybe` instead of `Option`.++* [#372](https://github.com/kowainik/relude/issues/372):+ Warn on usages of `readFileText`, `readFileLText`, `readFile` and `readFile'`.++ > _NOTE:_ This is a **breaking change** if you build with `-Werror`+ > and use the above functions. Use `readFileBS` / `readFileLBS`+ > instead to convert to `Text` / `LText` / `String` using+ > `decodeUtf8` and similar functions.++* [#394](https://github.com/kowainik/relude/issues/394):+ Support `hashable-1.4`.+* [#408](https://github.com/kowainik/relude/issues/408):+ Switch benchmarks from `criterion` to `tasty-bench`.+* [#404](https://github.com/kowainik/relude/issues/404):+ Fix condidion for `ordNubOn`, `intNub`, `intNubOn` export for `Relude.Nub` module.+ Use min version of `containers-0.6.0` instead of min version of GHC `8.4`. +* Minor documentation improvements and fixes.+ ## 1.0.0.1 — Mar 15, 2021 * Minor documentation changes.
README.md view
@@ -11,7 +11,7 @@ **`relude`** is a safe, performant, user-friendly and lightweight Haskell standard library. -The default `Prelude` is not perfect and doesn't always satisfies one's needs.+The default `Prelude` is not perfect and doesn't always satisfy one's needs. At this stage you may want to try an alternative prelude library. In this README we are going to give you convincing reasons to consider using `relude` as such alternative in your next project.@@ -58,7 +58,7 @@ use space-leaks-free functions (e.g. our custom performant `sum` and `product`), introduce `{-# INLINE #-}` and `{-# SPECIALIZE #-}` pragmas where appropriate, and make efficient container types- (e.g. `Map`, `HashMap`, `Set`) more accesible.+ (e.g. `Map`, `HashMap`, `Set`) more accessible. 5. **Minimalism** (low number of dependencies). We do not force users of `relude` to stick to any specific lens or text formatting or logging@@ -74,7 +74,7 @@ `bytestring` to dependencies in your `.cabal` file to use the main API of these libraries + No need to import types like `NonEmpty`, `Text`, `Set`, `Reader[T]`, `MVar`, `STM`- + Functions like `liftIO`, `fromMaybe`, `sortWith` are avaiable by default as well+ + Functions like `liftIO`, `fromMaybe`, `sortWith` are available by default as well + `IO` actions are lifted to `MonadIO` 7. **Excellent documentation.**@@ -117,6 +117,11 @@ * [No implicit Prelude](https://typeclasses.com/ghc/no-implicit-prelude) +For guiding development principles behind `relude` and comparison with+`base`, check out the following talk:++* [](https://www.youtube.com/watch?v=qwAmiJ5M_zM)+ ## Structure of this tutorial This tutorial has several parts:@@ -226,8 +231,8 @@ library exposed-modules: Example- build-depends: base >= 4.10 && < 4.13- , relude ^>= 1.0.0.0+ build-depends: base >= 4.14 && < 4.17+ , relude ^>= 1.1.0.0 mixins: base hiding (Prelude) , relude (Relude as Prelude)@@ -595,7 +600,7 @@ * `Foldable1` typeclass that contains generalized interface for folding non-empty structures like `NonEmpty`.-* [`StaticMap` and `DynamicMap` type classes](src/Relude/Extra/Map.hs) as a+* [`StaticMap` and `DynamicMap` type classes](https://github.com/kowainik/relude/blob/main/src/Relude/Extra/Map.hs) as a general interface for `Map`-like data structures. * And much more! @@ -650,7 +655,7 @@ + Use `encodeUtf8/decodeUtf8` to convert to/from `ByteString`. + Use `(putStr[Ln]|readFile|writeFile|appendFile)[Text|LText|BS|LBS]` functions. -6. Since `show` doesn't come from `Show` anymore, you need to export+6. Since `show` doesn't come from `Show` anymore, you need to import the `Text.Show` module if you want to implement `Show` instance manually. This can be done in the following way: ```haskell@@ -681,7 +686,7 @@ two commands on your CI: ```yaml-curl https://raw.githubusercontent.com/kowainik/relude/v1.0.0.0/.hlint.yaml -o .hlint-relude.yaml+curl https://raw.githubusercontent.com/kowainik/relude/v1.1.0.0/.hlint.yaml -o .hlint-relude.yaml curl -sSL https://raw.github.com/ndmitchell/neil/master/misc/travis.sh | sh -s -- hlint -h .hlint-relude.yaml . ``` @@ -731,7 +736,7 @@ * [Tutorial + migration guide](#structure-of-this-tutorial) from `Prelude` and just general description of the whole package and libraries it depends on.-6. `relude` has less dependencies and is slightly lighter because of that but still+6. `relude` has fewer dependencies and is slightly lighter because of that but still is very powerful and useful. 7. `relude` is opt-in oriented and has a notion of `Extra.*` modules that are not exported by default from the `Relude` module. That means that we do not@@ -749,17 +754,15 @@ Note, that we are using custom `hlint` setting which are `Relude` specific. To keep it up to date don't forget to reflect your changes in this file. We are-using `Dhall` to maintain the configurations. To use it follow the steps below.+using `Dhall` to maintain the configurations (lang version 22.0.0). To+use it follow the steps below. First time: ```shell-$ cabal v2-install dhall-yaml+$ cabal v2-install dhall-yaml-1.2.10 ``` -Dhall 16.0.0 is required, so make sure that the previous command installed-`dhall-yaml` >= 1.2.5.- To generate `hlint` file: ```shell@@ -790,4 +793,14 @@ ```shell cabal-plan dot --root lib:relude | dot -Tpng -o relude-dependency-graph.png+```++### Updating license headers++Install the `headroom` tool and run it from this repository:++```shell+cabal v2-install headroom-0.4.3.0+headroom run+rg "SPDX-License-Identifier : MPL-2.0" --files-with-matches src/ | xargs sed -i 's/SPDX-License-Identifier : MPL-2.0/SPDX-License-Identifier : MIT/g' ```
benchmark/Main.hs view
@@ -5,8 +5,7 @@ import Relude hiding (show) import Data.List (nub)-import Criterion (Benchmark, bench, bgroup, nf)-import Criterion.Main (defaultMain)+import Test.Tasty.Bench (Benchmark, bench, bgroup, defaultMain, nf) import Prelude (show) import qualified Data.HashSet as HashSet (insert)
relude.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: relude-version: 1.0.0.1+version: 1.1.0.0 synopsis: Safe, performant, user-friendly and lightweight Haskell Standard Library description: @__relude__@ is an alternative prelude library. If you find the default@@ -41,7 +41,7 @@ use space-leaks-free functions (e.g. our custom performant @sum@ and @product@), introduce @\{\-\# INLINE \#\-\}@ and @\{\-\# SPECIALIZE \#\-\}@ pragmas where appropriate, and make efficient container types- (e.g. @Map@, @HashMap@, @Set@) more accesible.+ (e.g. @Map@, @HashMap@, @Set@) more accessible. * __Minimalism__ (low number of dependencies). We do not force users of @relude@ to stick to any specific lens or text formatting or logging@@ -57,7 +57,7 @@ and @bytestring@ to dependencies in your @.cabal@ file to use the main API of these libraries 2. No need to import types like @NonEmpty@, @Text@, @Set@, @Reader[T]@, @MVar@, @STM@- 3. Functions like @liftIO@, @fromMaybe@, @sortWith@ are avaiable by default as well+ 3. Functions like @liftIO@, @fromMaybe@, @sortWith@ are available by default as well 4. @IO@ actions are lifted to @MonadIO@ * __Excellent documentation.__@@ -95,8 +95,9 @@ GHC == 8.4.4 GHC == 8.6.5 GHC == 8.8.4- GHC == 8.10.4- GHC == 9.0.1+ GHC == 8.10.7+ GHC == 9.0.2+ GHC == 9.2.2 source-repository head@@ -104,7 +105,7 @@ location: git@github.com:kowainik/relude.git common common-options- build-depends: base >= 4.10 && < 4.16+ build-depends: base >= 4.10 && < 4.17 ghc-options: -Wall -Wcompat@@ -121,6 +122,11 @@ ghc-options: -Wmissing-deriving-strategies if impl(ghc >= 8.10) ghc-options: -Wunused-packages+ if impl(ghc >= 9.0)+ ghc-options: -Winvalid-haddock+ if impl(ghc >= 9.2)+ ghc-options: -Wredundant-bang-patterns+ -Woperator-whitespace default-language: Haskell2010@@ -222,14 +228,14 @@ build-depends: bytestring >= 0.10 && < 0.12- , containers >= 0.5.7 && < 0.7+ , containers >= 0.5.10 && < 0.7 , deepseq ^>= 1.4- , ghc-prim >= 0.4.0.0 && < 0.8- , hashable >= 1.2 && < 1.4+ , ghc-prim >= 0.4.0.0 && < 0.9+ , hashable >= 1.2 && < 1.5 , mtl ^>= 2.2 , stm >= 2.4 && < 2.6- , text ^>= 1.2- , transformers ^>= 0.5+ , text >= 1.2 && < 2.1+ , transformers >= 0.5 && < 0.7 , unordered-containers >= 0.2.7 && < 0.3 @@ -246,7 +252,7 @@ , bytestring , containers , text- , hedgehog ^>= 1.0+ , hedgehog >= 1.0 && < 1.2 ghc-options: -threaded @@ -257,7 +263,7 @@ main-is: Doctest.hs build-depends: relude- , doctest+ , doctest ^>= 0.20 , Glob ghc-options: -threaded@@ -269,9 +275,7 @@ main-is: Main.hs build-depends: relude- , criterion+ , tasty-bench , unordered-containers - ghc-options: -threaded- -rtsopts- -with-rtsopts=-N+ ghc-options: -rtsopts
src/Relude.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable @relude@ is a safe, performant, user-friendly and lightweight Haskell standard library.
src/Relude/Applicative.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Applicative+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable This module contains reexports of 'Applicative' and related functional. Additionally, it provides convenient combinators to work with 'Applicative'.
src/Relude/Base.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Trustworthy #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Base+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Reexports from @Data.*@ and @GHC.*@ modules of <https://hackage.haskell.org/package/base base> package.@@ -50,7 +51,7 @@ import System.IO (FilePath, IO, IOMode (..)) -- Base typeclasses-import Data.Eq (Eq (..))+import Data.Eq (Eq, (==), (/=)) import Data.Ord (Down (..), Ord (..), Ordering (..), comparing) -- Types for type-level computation
src/Relude/Bool.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Bool+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Convenient commonly used and very helpful functions to work with 'Bool' and also with monads.
src/Relude/Bool/Guard.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Bool.Guard+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Monadic boolean combinators. -}
src/Relude/Bool/Reexport.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Bool.Reexport+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Reexports functions to work with 'Bool' type. -}
src/Relude/Container.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Container+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable This module exports all container-related stuff. -}
src/Relude/Container/One.hs view
@@ -4,13 +4,14 @@ {-# LANGUAGE TypeFamilies #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Container.One+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable 'One' is a typeclass for creating structures from a singleton element. It has three main goals:
src/Relude/Container/Reexport.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Trustworthy #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Container.Reexport+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Reexports container-related data types, functions and typeclasses from @base@, @containers@ and @unordered-containers@ packages.
src/Relude/Debug.hs view
@@ -17,13 +17,14 @@ #endif {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Debug+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable This module contains functions for debugging __pure__ functions. You can't use functions like 'System.IO.putStrLn' for this purpose because@@ -254,13 +255,13 @@ >>> error "oops" *** Exception: oops CallStack (from HasCallStack):- error, called at src\\Relude\\Debug.hs:288:11 in ...+ error, called at src\\Relude\\Debug.hs:289:11 in ... ... #else >>> error "oops" *** Exception: oops CallStack (from HasCallStack):- error, called at src/Relude/Debug.hs:288:11 in ...+ error, called at src/Relude/Debug.hs:289:11 in ... ... #endif
src/Relude/DeepSeq.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.DeepSeq+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable This module contains useful functions to evaluate expressions to weak-head normal form (WHNF) or just normal form (NF). Useful to force traces or @error@s
src/Relude/Enum.hs view
@@ -1,9 +1,12 @@+{-# LANGUAGE Safe #-}+ {- |-Copyright: (c) 2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Enum+Copyright : (c) 2021-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Reexports 'Enum' related typeclasses and functions. Also introduces a few useful helpers to work with Enums.@@ -89,7 +92,7 @@ shared for every call. __Memory usage note:__ don't inverse functions that have types like 'Int'-as their result. In this case the created 'M.Map' will have huge size.+as their input. In this case the created 'M.Map' will have huge size. The complexity of reversed mapping is \(\mathcal{O}(\log n)\).
src/Relude/Exception.hs view
@@ -9,13 +9,14 @@ #endif {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Exception+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Re-exports most useful functionality from the "Control.Exception" module. Also provides some convenient utilities to throw and handle exceptions.
src/Relude/Extra.hs view
@@ -1,9 +1,10 @@ {- |-Copyright: (c) 2019-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra+Copyright : (c) 2019-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable This module exports all extra-related stuff. The extra modules are not exported by default, but you can easily bring them to
src/Relude/Extra/Bifunctor.hs view
@@ -1,11 +1,12 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra.Bifunctor+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Useful combinators for bifunctors inside functors. This set of functions is useful when you want to work with types like these ones:
src/Relude/Extra/CallStack.hs view
@@ -1,11 +1,12 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra.CallStack+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Contains useful functions to work with GHC callstack.
src/Relude/Extra/Enum.hs view
@@ -1,11 +1,12 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra.Enum+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Mini @bounded-enum@ framework inside @relude@.
src/Relude/Extra/Foldable.hs view
@@ -2,11 +2,12 @@ {-# LANGUAGE BangPatterns #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra.Foldable+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Contains utility functions for working with tuples.
src/Relude/Extra/Foldable1.hs view
@@ -8,12 +8,13 @@ {-# LANGUAGE UndecidableInstances #-} {- |-Copyright: (c) 2011-2015 Edward Kmett- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra.Foldable1+Copyright : (c) 2011-2015 Edward Kmett+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable 'Foldable1' is a typeclass like 'Data.Foldable.Foldable' but for non-empty structures. For example, 'Relude.NonEmpty', 'Relude.Identity'.
src/Relude/Extra/Group.hs view
@@ -2,11 +2,12 @@ {-# LANGUAGE TypeFamilies #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra.Group+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Polymorphic grouping functions.
src/Relude/Extra/Lens.hs view
@@ -2,12 +2,13 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2012-2016 Edward Kmett- (c) 2019-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra.Lens+Copyright : (c) 2012-2016 Edward Kmett+ (c) 2019-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable @since 0.5.0 @@ -158,7 +159,6 @@ - [lens](https://hackage.haskell.org/package/lens) - [microlens](https://hackage.haskell.org/package/microlens) - [lens tutorial](http://hackage.haskell.org/package/lens-tutorial-1.0.3/docs/Control-Lens-Tutorial.html)- -} module Relude.Extra.Lens
src/Relude/Extra/Map.hs view
@@ -2,11 +2,12 @@ {-# LANGUAGE TypeFamilies #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra.Map+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Contains implementation of polymorphic type classes for data types 'Set' and 'Map'.
src/Relude/Extra/Newtype.hs view
@@ -2,11 +2,12 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra.Newtype+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Functions to ease work with @newtypes@.
src/Relude/Extra/Tuple.hs view
@@ -2,11 +2,12 @@ {-# LANGUAGE TupleSections #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra.Tuple+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Contains utility functions for working with tuples.
src/Relude/Extra/Type.hs view
@@ -9,11 +9,12 @@ {-# LANGUAGE UndecidableInstances #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Experimental-Portability: Portable+Module : Relude.Extra.Type+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Contains useful utilities to work with Types. @@ -35,7 +36,7 @@ -- $setup--- >>> :set -XDataKinds -XTypeOperators+-- >>> :set -XAllowAmbiguousTypes -XDataKinds -XExplicitNamespaces -XPolyKinds -XTypeFamilies -XTypeOperators -XUndecidableInstances {- | Gets a string representation of a type. @@ -58,7 +59,18 @@ {- | Concatenates type-level lists. -#if ( __GLASGOW_HASKELL__ >= 806 )+#if ( __GLASGOW_HASKELL__ >= 902 )++>>> :kind! '[ 'Just 5, 'Nothing] ++ '[ 'Just 3, 'Nothing, 'Just 1]+'[ 'Just 5, 'Nothing] ++ '[ 'Just 3, 'Nothing, 'Just 1] :: [Maybe+ Natural]+= '[ 'Just 5, 'Nothing, 'Just 3, 'Nothing, 'Just 1]++>>> :kind! '[] ++ '[ 'Just 3, 'Nothing, 'Just 1]+'[] ++ '[ 'Just 3, 'Nothing, 'Just 1] :: [Maybe Natural]+= '[ 'Just 3, 'Nothing, 'Just 1]++#elif ( __GLASGOW_HASKELL__ >= 806 ) >>> :kind! '[ 'Just 5, 'Nothing] ++ '[ 'Just 3, 'Nothing, 'Just 1] '[ 'Just 5, 'Nothing] ++ '[ 'Just 3, 'Nothing, 'Just 1] :: [Maybe
src/Relude/File.hs view
@@ -1,11 +1,12 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.File+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Lifted to 'MonadIO' families of file processing functions for the 'Text', 'LText', 'ByteString' and 'LByteString' types.@@ -20,6 +21,15 @@ data with the help of functions from the "Relude.String.Conversion" module, e. g. 'Relude.String.Conversion.decodeUtf8'. +To be more precise, avoid the following functions:++* 'readFileText'+* 'readFileLText'++See the following blog post for more details:++* [Beware of readFile by Michael Snoyman](https://www.snoyman.com/blog/2016/12/beware-of-readfile/)+ @since 0.3.0 -} @@ -68,6 +78,7 @@ readFileText = liftIO . T.readFile {-# SPECIALIZE readFileText :: FilePath -> IO Text #-} {-# INLINE readFileText #-}+{-# WARNING readFileText ["'readFileText' depends on the system's locale settings and can throw unexpected exceptions.", "Use 'readFileBS' instead."] #-} {- | Lifted version of 'T.writeFile'. @@ -99,6 +110,7 @@ readFileLText = liftIO . LT.readFile {-# SPECIALIZE readFileLText :: FilePath -> IO LText #-} {-# INLINE readFileLText #-}+{-# WARNING readFileLText ["'readFileLText' depends on the system's locale settings and can throw unexpected exceptions.", "Use 'readFileLBS' instead."] #-} {- | Lifted version of 'LT.writeFile'.
src/Relude/Foldable.hs view
@@ -1,11 +1,12 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Foldable+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable This module provides 'Foldable' and 'Traversable' related types and functions. -}
src/Relude/Foldable/Fold.hs view
@@ -8,13 +8,14 @@ {-# LANGUAGE UndecidableInstances #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Foldable.Fold+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Fixes and additions to 'Foldable'. Specifically:
src/Relude/Foldable/Reexport.hs view
@@ -2,11 +2,12 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Foldable.Reexport+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Reexports "Data.Foldable" and "Data.Traversable". -}
src/Relude/Function.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Function+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable This module reexports very basic and primitive functions and function combinators.
src/Relude/Functor.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Functor+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Convenient functions to work with 'Functor'. -}
src/Relude/Functor/Fmap.hs view
@@ -2,13 +2,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Functor.Fmap+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable This module contains useful functions to work with 'Functor' type class. -}
src/Relude/Functor/Reexport.hs view
@@ -2,13 +2,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Functor.Reexport+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Reexports functionality regarding 'Functor' and 'Bifunctor' typeclasses. -}
src/Relude/Lifted.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Lifted+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Lifted versions of base functions. @@ -58,7 +59,6 @@ x <- 'getLine' 'print' x @- -} module Relude.Lifted
src/Relude/Lifted/Concurrent.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Lifted.Concurrent+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Lifted 'MVar' and 'STM' functions. -}
src/Relude/Lifted/Env.hs view
@@ -1,9 +1,12 @@+{-# LANGUAGE Safe #-}+ {- |-Copyright: (c) 2020-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Lifted.Env+Copyright : (c) 2020-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Lifted functions to work with system environment.
src/Relude/Lifted/Exit.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Lifted.Exit+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Lifted versions of functions that work with exit processes. -}
src/Relude/Lifted/File.hs view
@@ -2,13 +2,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Lifted.File+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Lifted versions of functions working with files and common IO. -}@@ -35,6 +36,7 @@ readFile = liftIO . IO.readFile {-# SPECIALIZE readFile :: FilePath -> IO String #-} {-# INLINE readFile #-}+{-# WARNING readFile ["'readFile' depends on the system's locale settings and can throw unexpected exceptions.", "Use 'readFileBS' or 'readFileLBS' instead."] #-} #if ( __GLASGOW_HASKELL__ >= 900 ) {- | Lifted version of 'IO.readFile''. Strict version of 'readFile'.@@ -45,6 +47,7 @@ readFile' = liftIO . IO.readFile' {-# SPECIALIZE readFile' :: FilePath -> IO String #-} {-# INLINE readFile' #-}+{-# WARNING readFile' ["readFile' depends on the system's locale settings and can throw unexpected exceptions.", "Use 'readFileBS' or 'readFileLBS' instead."] #-} #endif -- | Lifted version of 'IO.writeFile'.
src/Relude/Lifted/Handle.hs view
@@ -1,9 +1,12 @@+{-# LANGUAGE Safe #-}+ {- |-Copyright: (c) 2020-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Lifted.Handle+Copyright : (c) 2020-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Lifted functions to work with 'IO' 'Handle's.
src/Relude/Lifted/IORef.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Lifted.IORef+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Lifted reexports from "Data.IORef" module. -}
src/Relude/Lifted/Terminal.hs view
@@ -1,11 +1,12 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Lifted.Terminal+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Lifted functions to work with stdin and stdout.
src/Relude/List.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.List+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Utility functions to work with lists and 'NonEmpty' lists. -}
src/Relude/List/NonEmpty.hs view
@@ -6,13 +6,14 @@ {-# LANGUAGE UndecidableInstances #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.List.NonEmpty+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable This module contains reexports from "Data.List.NonEmpty" and safe functions to work with list type in terms of 'NonEmpty'.
src/Relude/List/Reexport.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Trustworthy #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.List.Reexport+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Reexports most of the "Data.List". -}
src/Relude/Monad.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Monad+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Reexporting useful monadic stuff. -}
src/Relude/Monad/Either.hs view
@@ -3,13 +3,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Monad.Either+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Utilities to work with 'Relude.Either' data type. -}
src/Relude/Monad/Maybe.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Monad.Maybe+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Utility functions to work with 'Relude.Maybe' data type as monad. -}
src/Relude/Monad/Reexport.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Monad.Reexport+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Reexports functions to work with monads. -}
src/Relude/Monad/Trans.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Trustworthy #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Monad.Trans+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Monad transformers utilities. -}@@ -85,7 +86,7 @@ For a detailed explanation, refer to the following blog post: -* <https://www.joachim-breitner.de/blog/763-Faster_Winter_5__Eta-Expanding_ReaderT Faster Winter 5: Eta-Expanding ReaderT (by Joachim Breitners)>+* <https://www.joachim-breitner.de/blog/763-Faster_Winter_5__Eta-Expanding_ReaderT Faster Winter 5: Eta-Expanding ReaderT (by Joachim Breitner)> @since 0.7.0.0 -}
src/Relude/Monoid.hs view
@@ -8,13 +8,14 @@ #endif {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Monoid+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Reexports functions to work with monoids plus adds extra useful functions. -}@@ -37,8 +38,8 @@ #endif import Data.Monoid (All (..), Alt (..), Any (..), Dual (..), Endo (..), First (..), Last (..), Monoid (..), Product (..), Sum (..))-import Data.Semigroup (Option (..), Semigroup (sconcat, stimes, (<>)), WrappedMonoid, cycle1,- mtimesDefault, stimesIdempotent, stimesIdempotentMonoid, stimesMonoid)+import Data.Semigroup (Semigroup (sconcat, stimes, (<>)), WrappedMonoid, cycle1, mtimesDefault,+ stimesIdempotent, stimesIdempotentMonoid, stimesMonoid) import Relude.Bool.Reexport (Bool (..)) import Relude.Monad.Reexport (Maybe, fromMaybe)
src/Relude/Nub.hs view
@@ -2,13 +2,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Nub+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Functions to remove duplicates from a list. @@ -41,7 +42,7 @@ ( hashNub , ordNub -#if __GLASGOW_HASKELL__ > 804+#if MIN_VERSION_containers(0,6,0) , ordNubOn , intNub , intNubOn@@ -51,14 +52,16 @@ , unstableNub ) where +#if !MIN_VERSION_hashable(1,4,0) import Data.Eq (Eq)-import Data.Hashable (Hashable)+#endif import Data.HashSet as HashSet+import Data.Hashable (Hashable) import Data.Ord (Ord) import Prelude (Int, (.)) import qualified Data.Set as Set-#if __GLASGOW_HASKELL__ > 804+#if MIN_VERSION_containers(0,6,0) import qualified Data.Containers.ListUtils as Containers #endif @@ -76,7 +79,7 @@ -} ordNub :: forall a . (Ord a) => [a] -> [a]-#if __GLASGOW_HASKELL__ > 804+#if MIN_VERSION_containers(0,6,0) ordNub = Containers.nubOrd {-# INLINE ordNub #-} #else@@ -92,7 +95,7 @@ #endif -#if __GLASGOW_HASKELL__ > 804+#if MIN_VERSION_containers(0,6,0) {- | Similar to 'ordNub' but performs nub through the mapped list on the given function. @@ -112,7 +115,11 @@ [3,2,-1,1] -}+#if MIN_VERSION_hashable(1,4,0)+hashNub :: forall a . (Hashable a) => [a] -> [a]+#else hashNub :: forall a . (Eq a, Hashable a) => [a] -> [a]+#endif hashNub = go HashSet.empty where go :: HashSet.HashSet a -> [a] -> [a]@@ -139,17 +146,20 @@ [1,2,3,-1] -}+#if MIN_VERSION_hashable(1,4,0)+unstableNub :: (Hashable a) => [a] -> [a]+#else unstableNub :: (Eq a, Hashable a) => [a] -> [a]+#endif unstableNub = HashSet.toList . HashSet.fromList {-# INLINE unstableNub #-} -#if __GLASGOW_HASKELL__ > 804-+#if MIN_VERSION_containers(0,6,0) {- | Removes duplicate elements from a list, keeping only the first occurance of the element. -Like 'Prelude.nub' but runs in \( O(n \min\(n, int_bits\)) \) time and requires 'Ord'.+Like 'Prelude.nub' but runs in \( O (n \min (n, int\_bits )) \) time and requires 'Ord'. >>> intNub [3, 3, 3, 2, 2, -1, 1] [3,2,-1,1]
src/Relude/Numeric.hs view
@@ -1,11 +1,12 @@ {-# LANGUAGE Trustworthy #-} {- |-Copyright: (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Numeric+Copyright : (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Provides numerical data types and functions.
src/Relude/Print.hs view
@@ -4,13 +4,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Print+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Functions like 'Prelude.putStr' and 'Prelude.putStrLn' but for 'Text', 'LText', 'ByteString' and 'LByteString'.
src/Relude/String.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Safe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.String+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Type classes for conversion between different string representations. @@ -36,7 +37,6 @@ +-----------------------+---------------------+--------------+--------------+--------------------+------------------------+--------------------------+ | __'ShortByteString'__ | 'decodeUtf8' | 'decodeUtf8' | 'fromShort' | 'decodeUtf8' |@'toLazy' . 'fromShort'@| ~ | +-----------------------+---------------------+--------------+--------------+--------------------+------------------------+--------------------------+- -} module Relude.String
src/Relude/String/Conversion.hs view
@@ -10,13 +10,14 @@ {-# LANGUAGE UndecidableInstances #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.String.Conversion+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable This module implements type class which allow to have conversion to and from 'Relude.String.Reexport.Text', 'String' and 'ByteString' types@@ -100,8 +101,14 @@ >>> decodeUtf8 @Text @ByteString "\208\208\176\209\130\208\176\208\186" "\65533\65533\1090\1072\1082" #endif++#if MIN_VERSION_text(2,0,0) >>> decodeUtf8Strict @Text @ByteString "\208\208\176\209\130\208\176\208\186"+ Left Cannot decode byte '\xd0': Data.Text.Internal.Encoding: Invalid UTF-8 stream+#else+ >>> decodeUtf8Strict @Text @ByteString "\208\208\176\209\130\208\176\208\186" Left Cannot decode byte '\xd0': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream+#endif -} decodeUtf8Strict :: b -> Either T.UnicodeException a
src/Relude/String/Reexport.hs view
@@ -7,13 +7,14 @@ {-# LANGUAGE UndecidableInstances #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.String.Reexport+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable Reexports functions to work with 'Data.Text.Text', 'ByteString' and 'ShortByteString' types.
src/Relude/Unsafe.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE Unsafe #-} {- |-Copyright: (c) 2016 Stephen Diehl- (c) 2016-2018 Serokell- (c) 2018-2021 Kowainik-SPDX-License-Identifier: MIT-Maintainer: Kowainik <xrom.xkov@gmail.com>-Stability: Stable-Portability: Portable+Module : Relude.Unsafe+Copyright : (c) 2016 Stephen Diehl+ (c) 2016-2018 Serokell+ (c) 2018-2022 Kowainik+SPDX-License-Identifier : MIT+Maintainer : Kowainik <xrom.xkov@gmail.com>+Stability : Stable+Portability : Portable __⚠️ Warning ⚠️__
test/Doctest.hs view
@@ -9,7 +9,8 @@ main = do sourceFiles <- glob "src/**/*.hs" doctest- $ "-XInstanceSigs"+ $ "-XHaskell2010"+ : "-XInstanceSigs" : "-XNoImplicitPrelude" : "-XOverloadedStrings" : "-XScopedTypeVariables"