packages feed

relude-1.2.2.2: relude.cabal

cabal-version:       3.0
name:                relude
version:             1.2.2.2
synopsis:            Safe, performant, user-friendly and lightweight Haskell Standard Library
description:
    @__relude__@ is an alternative prelude library. If you find the default
    @Prelude@ unsatisfying, despite its advantages, consider using @relude@
    instead.

    == Relude goals and design principles
    * __Productivity.__ You can be more productive with a "non-standard" standard
      library, and @relude@ helps you with writing safer and more
      efficient code faster.

    * __Total programming__. Usage of [/partial functions/](https://www.reddit.com/r/haskell/comments/5n51u3/why_are_partial_functions_as_in_head_tail_bad/)
      can lead to unexpected bugs and runtime exceptions in pure
      code. The types of partial functions lie about their behaviour. And
      even if it is not always possible to rely only on total functions,
      @relude@ strives to encourage best-practices and reduce the
      chances of introducing a bug.

        +---------------------------------+--------------------------------------------+
        | __Partial__                     | __Total__                                  |
        +=================================+============================================+
        | @head :: [a] -> a@              | @head :: NonEmpty a -> a@                  |
        +---------------------------------+--------------------------------------------+
        | @tail :: [a] -> [a]@            | @tail :: NonEmpty a -> [a]@                |
        +---------------------------------+--------------------------------------------+
        | @read :: Read a => String -> a@ | @readMaybe :: Read a => String -> Maybe a@ |
        +---------------------------------+--------------------------------------------+
        | @fromJust :: Maybe a -> a@      | @fromMaybe :: a -> Maybe a -> a@           |
        +---------------------------------+--------------------------------------------+

    * __Type-safety__. We use the /"make invalid states unrepresentable"/ motto as one
      of our guiding principles. If it is possible, we express this concept through the
      types.

        /Example:/ @ whenNotNull :: Applicative f => [a] -> (NonEmpty a -> f ()) -> f () @

    * __Performance.__ We prefer @Text@ over @[String](https://www.reddit.com/r/haskell/comments/29jw0s/whats_wrong_with_string/)@,
      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 accessible.

    * __Minimalism__ (low number of dependencies). We do not force users of
      @relude@ to stick to any specific lens or text formatting or logging
      library. Where possible, @relude@ depends only on boot libraries.
      The [Dependency graph](https://raw.githubusercontent.com/kowainik/relude/main/relude-dependency-graph.png)
      of @relude@ can give you a clearer picture.

    * __Convenience__. Despite minimalism, we want to bring commonly used
       types and functions into scope, and make available functions easier
       to use. Some examples of conveniences:

        1. No need to add @containers@, @unordered-containers@, @text@
           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 available by default as well
        4. @IO@ actions are lifted to @MonadIO@

    * __Excellent documentation.__

        1. Tutorial
        2. Migration guide from @Prelude@
        3. Haddock for every function with examples tested by
           [doctest](http://hackage.haskell.org/package/doctest).
        4. Documentation regarding [internal module structure](http://hackage.haskell.org/package/relude/docs/Relude.html)
        5. @relude@-specific [HLint](http://hackage.haskell.org/package/hlint) rules: @[.hlint.yaml](https://github.com/kowainik/relude/blob/main/.hlint.yaml)@

    * __User-friendliness.__ Anyone should be able to quickly migrate to @relude@. Only
      some basic familiarity with the common libraries like @text@ and @containers@
      should be enough (but not necessary).

    * __Exploration.__ We have space to experiment with new ideas and proposals
      without introducing breaking changes. @relude@ uses the approach with
      @Extra.*@ modules which are not exported by default. The chosen approach makes it quite
      easy for us to provide new functionality without breaking anything and let
      the users decide to use it or not.

homepage:            https://github.com/kowainik/relude
bug-reports:         https://github.com/kowainik/relude/issues
license:             MIT
license-file:        LICENSE
author:              Dmitrii Kovanikov, Veronika Romashkina, Stephen Diehl, Serokell
maintainer:          Kowainik <xrom.xkov@gmail.com>
copyright:           2016 Stephen Diehl, 2016-2018 Serokell, 2018-2023 Kowainik
category:            Prelude
stability:           stable
build-type:          Simple
extra-doc-files:     CHANGELOG.md
                     README.md
tested-with:         GHC == 8.4.4
                     GHC == 8.6.5
                     GHC == 8.8.4
                     GHC == 8.10.7
                     GHC == 9.0.2
                     GHC == 9.2.8
                     GHC == 9.4.7
                     GHC == 9.6.6
                     GHC == 9.8.2
                     GHC == 9.10.1


source-repository head
  type:     git
  location: git@github.com:kowainik/relude.git

common common-options
  ghc-options:         -Wall
                       -Wcompat
                       -Widentities
                       -Wincomplete-uni-patterns
                       -Wincomplete-record-updates
                       -fwarn-implicit-prelude
                       -Wredundant-constraints
                       -fhide-source-paths
  if impl(ghc >= 8.4)
    ghc-options:       -Wmissing-export-lists
                       -Wpartial-fields
  if impl(ghc >= 8.8)
    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
  if impl(ghc >= 9.4  && < 9.10)
    ghc-options:       -Wforall-identifier
  if impl(ghc >= 9.4)
    ghc-options:       -Wredundant-strictness-flags
  if impl(ghc >= 9.8)
    ghc-options:       -Wterm-variable-capture
                       -Winconsistent-flags


  default-language:    Haskell2010
  default-extensions:  InstanceSigs
                       NoImplicitPrelude
                       OverloadedStrings
                       ScopedTypeVariables
                       TypeApplications

library
  import:              common-options
  hs-source-dirs:      src
  exposed-modules:
                       Relude
                           Relude.Applicative
                           Relude.Base
                           Relude.Bool
                               Relude.Bool.Guard
                               Relude.Bool.Reexport
                           Relude.Container
                               Relude.Container.One
                               Relude.Container.Reexport
                           Relude.Debug
                           Relude.DeepSeq
                           Relude.Enum
                           Relude.Exception
                           Relude.File
                           Relude.Foldable
                               Relude.Foldable.Fold
                               Relude.Foldable.Reexport
                           Relude.Function
                           Relude.Functor
                               Relude.Functor.Fmap
                               Relude.Functor.Reexport
                           Relude.Lifted
                               Relude.Lifted.Concurrent
                               Relude.Lifted.Exit
                               Relude.Lifted.File
                               Relude.Lifted.IORef
                               Relude.Lifted.Terminal
                               Relude.Lifted.Handle
                               Relude.Lifted.Env
                           Relude.List
                               Relude.List.NonEmpty
                               Relude.List.Reexport
                           Relude.Monad
                               Relude.Monad.Either
                               Relude.Monad.Maybe
                               Relude.Monad.Reexport
                               Relude.Monad.Trans
                           Relude.Monoid
                           Relude.Nub
                           Relude.Numeric
                           Relude.Print
                           Relude.String
                               Relude.String.Conversion
                               Relude.String.Reexport

                           -- not exported by default
                           Relude.Extra
                               Relude.Extra.Bifunctor
                               Relude.Extra.CallStack
                               Relude.Extra.Enum
                               Relude.Extra.Foldable
                               Relude.Extra.Foldable1
                               Relude.Extra.Group
                               Relude.Extra.Lens
                               Relude.Extra.Map
                               Relude.Extra.Newtype
                               Relude.Extra.Tuple
                               Relude.Extra.Type
                           Relude.Unsafe

  reexported-modules:
    -- containers
    , Data.IntMap.Lazy
    , Data.IntMap.Strict
    , Data.IntSet
    , Data.Map.Lazy
    , Data.Map.Strict
    , Data.Set
    , Data.Sequence
    , Data.Tree
    -- unordered-containers
    , Data.HashMap.Lazy
    , Data.HashMap.Strict
    , Data.HashSet
    -- text
    , Data.Text
    , Data.Text.IO
    , Data.Text.Lazy
    , Data.Text.Lazy.IO
    , Data.Text.Read
    -- bytestring
    , Data.ByteString
    , Data.ByteString.Builder
    , Data.ByteString.Lazy
    , Data.ByteString.Short


  build-depends:       base >= 4.11 && < 4.22
                     , bytestring >= 0.10 && < 0.13
                     , containers >= 0.5.10 && < 0.9
                     , deepseq >= 1.4 && < 1.6
                     , ghc-prim >= 0.5.0.0 && < 0.14
                     , hashable >= 1.2 && < 1.6
                     , mtl >= 2.2 && < 2.4
                     , stm >= 2.4 && < 2.6
                     , text >= 1.2 && < 2.2
                     , transformers >= 0.5 && < 0.7
                     , unordered-containers >= 0.2.7 && < 0.3


test-suite relude-test
  import:              common-options
  type:                exitcode-stdio-1.0
  hs-source-dirs:      test
  main-is:             Spec.hs

  other-modules:       Test.Relude.Gen
                       Test.Relude.Container.One
                       Test.Relude.Property
  build-depends:       base
                     , relude
                     , bytestring
                     , containers
                     , text
                     , hedgehog >= 1.0 && < 1.6

  ghc-options:         -threaded

test-suite relude-doctest
  import:              common-options
  type:                exitcode-stdio-1.0
  hs-source-dirs:      test
  main-is:             Doctest.hs

  build-depends:       relude
                     , doctest >= 0.20 && < 0.25
                     , Glob

  ghc-options:         -threaded

benchmark relude-benchmark
  import:              common-options
  type:                exitcode-stdio-1.0
  hs-source-dirs:      benchmark
  main-is:             Main.hs

  build-depends:       base
                     , relude
                     , tasty-bench
                     , unordered-containers

  ghc-options:         -rtsopts