packages feed

relude-1.2.2.0 / src / Relude.hs

{-# LANGUAGE Safe #-}{- |Module                  : ReludeCopyright               : (c) 2016 Stephen Diehl                          (c) 2016-2018 Serokell                          (c) 2018-2023 KowainikSPDX-License-Identifier : MITMaintainer              : Kowainik <xrom.xkov@gmail.com>Stability               : StablePortability             : Portable@relude@ is a safe, performant, user-friendly and lightweight Haskellstandard library."Relude" is the main module that reexports all functionality provided by the library that will replace the default @Prelude@ in your project.== UsageTo start using @relude@ in your project, you can set the library up for you byone of the following ways.=== mixinsOne of the most convenient ways to use @relude@ is via the @mixins@ feature. Thisfeature is available since @Cabal >= 2.2@. In order to use the @mixins@ featureone needs to specify supported @cabal-version@ in your package description.And then the following lines should be added to the required stanza to replacedefault "Prelude" with @relude@.@cabal-version: 2.4...library  ...  mixins: base hiding (Prelude)        , relude (Relude as Prelude)        , relude@=== @base-noprelude@Alternatively, you can replace @base@ package in your dependencies with@[base-noprelude](http://hackage.haskell.org/package/base-noprelude)@ and addthe following "Prelude" module to your package to use @relude@ by default inevery module instead of @base@ "Prelude":@__module__ Prelude    ( __module__ "Relude"    ) __where____import__ "Relude"@=== @NoImplicitPrelude@If you want to use @relude@ per-module basis then just add next lines to yourmodule to replace default "Prelude":@\{\-\# LANGUAGE NoImplicitPrelude \#\-\}__import__ "Relude"@== StructureThis documentation section contains the description of internal module structure tohelp navigate between modules, search for interesting functionalities andunderstand where you need to put your new changes (if you're a contributor).Functions and types are distributed across multiple modules and grouped bymeaning or __category__. Name of the module should give you hints regarding whatthis module contains. Some /categories/ contain a significant amount of bothreexportedfunctions and functions of our own. To make it easier to understand these enormouschunks of functions, all reexported stuff is moved into the separate module withname @Relude.SomeCategory.Reexport@ and our own functions and types are in@Relude.SomeCategory.SomeName@. For example, see modules"Relude.Foldable.Fold" and "Relude.Foldable.Reexport".-}module Relude    ( -- * Default Modules      module Relude.Applicative      -- $applicative    , module Relude.Base      -- $base    , module Relude.Bool      -- $bool    , module Relude.Container      -- $container    , module Relude.Debug      -- $debug    , module Relude.DeepSeq      -- $deepseq    , module Relude.Enum      -- $enum    , module Relude.Exception      -- $exception    , module Relude.File      -- $file    , module Relude.Foldable      -- $foldable    , module Relude.Function      -- $function    , module Relude.Functor      -- $functor    , module Relude.Lifted      -- $lifted    , module Relude.List      -- $list    , module Relude.Monad      -- $monad    , module Relude.Monoid      -- $monoid    , module Relude.Nub      -- $nub    , module Relude.Numeric      -- $numeric    , module Relude.Print      -- $print    , module Relude.String      -- $string      -- * Extra Modules      -- $extra    ) whereimport Relude.Applicativeimport Relude.Baseimport Relude.Boolimport Relude.Containerimport Relude.Debugimport Relude.DeepSeqimport Relude.Enumimport Relude.Exceptionimport Relude.Fileimport Relude.Foldableimport Relude.Functionimport Relude.Functorimport Relude.Liftedimport Relude.Listimport Relude.Monadimport Relude.Monoidimport Relude.Nubimport Relude.Numericimport Relude.Printimport Relude.String{- $applicative__"Relude.Applicative"__ contains reexports from "Control.Applicative" and somegeneral-purpose applicative combinators.-}{- $base__"Relude.Base"__ contains different general types and type classes from @base@package ('Char', 'Eq', 'Generic', etc.) not exported by other modules.-}{- $bool__"Relude.Bool"__ contains 'Bool' data type with different predicates and combinators.-}{- $container__"Relude.Container"__ provides 'One' typeclass for creating data structuresfrom singleton element and reexports of types from packages @containers@ and@unordered-containers@.-}{- $debug__"Relude.Debug"__ contains @trace@-like debugging functions with compile-timewarnings (so you don't forget to remove them).-}{- $deepseq__"Relude.DeepSeq"__ has reexports from "Control.DeepSeq" module and functionsto evaluate expressions to weak-head normal form or normal form.-}{- $enum__"Relude.Enum"__ reexports 'Enum' related typeclasses and functions. Alsointroduced a few useful helpers to work with Enums.-}{- $exception__"Relude.Exception"__ contains reexports from "Control.Exception", introduces'bug' function as better 'error' and 'Exc' pattern synonym for convenientpattern-matching on exceptions.-}{- $file__"Relude.File"__ implements functions to work with file content as 'Text' or'ByteString'.-}{- $foldable__"Relude.Foldable"__ reexports functions for 'Foldable' and 'Traversable' andprovide own better alternatives to some existing functions.-}{- $function__"Relude.Function"__ contains almost everything from the "Data.Function" module.-}{- $functor__"Relude.Functor"__ contains reexports from "Data.Functor", "Data.Bifunctor",other useful 'Functor' combinators.-}{- $lifted__"Relude.Lifted"__ implements lifted to 'MonadIO' functions to work withconsole, files, 'IORef's, 'MVar's, etc.-}{- $list__"Relude.List"__ provides big chunk of "Data.List", 'NonEmpty' type andfunctions for this type ('head', 'tail', 'last', 'init').-}{- $monad__"Relude.Monad"__ contains functions and data types from "Data.Maybe" and"Data.Either" modules, monad transformers and other various combinators.-}{- $monoid__"Relude.Monoid"__ reexports various types and functions from "Data.Monoid" and"Data.Semigroup".-}{- $nub__"Relude.Nub"__ implements better versions of @nub@ function for list.-}{- $numeric__"Relude.Numeric"__ contains functions and types to work with numerical data.-}{- $print__"Relude.Print"__ contains printing to terminal functions for 'Text' and 'ByteString'.-}{- $string__"Relude.String"__ contains reexports from @text@ and @bytestring@ packageswith conversion functions between different textual types.-}{- $extraThe following modules are not exported by default, but you can easily bring them toevery module in your package by modifying your "Prelude" file:+------------------------------+-----------------------------------------------------------+| __"Relude.Extra"__           | Reexports every @Relude.Extra.*@ module                   |+------------------------------+-----------------------------------------------------------+| __"Relude.Extra.Bifunctor"__ | Additional combinators for 'Bifunctor'.                   |+------------------------------+-----------------------------------------------------------+| __"Relude.Extra.CallStack"__ | Useful functions to extract information from 'CallStack'. |+------------------------------+-----------------------------------------------------------+| __"Relude.Extra.Enum"__      | Extra utilities for types that implement 'Bounded'        ||                              | and 'Enum' constraints.                                   |+------------------------------+-----------------------------------------------------------+| __"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              ||                              | like 'Foldable' but for non-empty structures.             |+------------------------------+-----------------------------------------------------------+| __"Relude.Extra.Group"__     | Grouping functions, polymorphic on return @Map@ type.     |+------------------------------+-----------------------------------------------------------+| __"Relude.Extra.Lens"__      | Minimal implementation of @lens@ package required         ||                              | for basic usage.                                          |+------------------------------+-----------------------------------------------------------+| __"Relude.Extra.Map"__       | Typeclass for @Map@-like data structures.                 |+------------------------------+-----------------------------------------------------------+| __"Relude.Extra.Newtype"__   | Generic functions that automatically work for any         ||                              | @newtype@.                                                |+------------------------------+-----------------------------------------------------------+| __"Relude.Extra.Tuple"__     | Functions for working with tuples.                        |+------------------------------+-----------------------------------------------------------+| __"Relude.Extra.Type"__      | Functions for inspecting and working with types.          |+------------------------------+-----------------------------------------------------------+| __"Relude.Unsafe"__          | Unsafe partial functions (produce 'error') for lists and  ||                              | 'Maybe'.                                                  |+------------------------------+-----------------------------------------------------------+-}