├── cabal.project ├── .github └── workflows │ ├── cd.yaml │ └── ci.yaml ├── LICENSE ├── library ├── BasePrelude │ ├── DataTypes.hs │ └── Operators.hs └── BasePrelude.hs ├── CHANGELOG.md └── base-prelude.cabal /cabal.project: -------------------------------------------------------------------------------- 1 | packages: . 2 | -------------------------------------------------------------------------------- /.github/workflows/cd.yaml: -------------------------------------------------------------------------------- 1 | name: Release the lib to Hackage 2 | 3 | on: 4 | push: 5 | branches: 6 | - supermajor 7 | - major 8 | - minor 9 | - patch 10 | 11 | concurrency: 12 | group: cd 13 | cancel-in-progress: false 14 | 15 | jobs: 16 | 17 | ci: 18 | uses: ./.github/workflows/ci.yaml 19 | secrets: inherit 20 | 21 | cd: 22 | needs: 23 | - ci 24 | runs-on: ubuntu-latest 25 | steps: 26 | - uses: actions/checkout@v3 27 | 28 | - name: Release 29 | uses: nikita-volkov/release-haskell-package.github-action@v1.2.0 30 | with: 31 | hackage-token: ${{ secrets.HACKAGE_TOKEN }} 32 | version-bump-place: ${{ fromJSON('{"supermajor":0,"major":1,"minor":2,"patch":3}')[github.ref_name] }} 33 | main-branch: master 34 | prefix-tag-with-v: false 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, Nikita Volkov 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /library/BasePrelude/DataTypes.hs: -------------------------------------------------------------------------------- 1 | -- | 2 | -- A module that reexports only the data types 3 | -- defined across various modules of the \"base\" package. 4 | -- 5 | -- By data types we mean that it is the ones we use 6 | -- to define data structures. 7 | -- It is not abstraction integration wrappers, 8 | -- like 'Data.Semigroup.First'. 9 | -- It is not resource types like 'System.IO.Handle'. 10 | module BasePrelude.DataTypes 11 | ( -- * From "Prelude" 12 | Prelude.Bool (..), 13 | Prelude.Char, 14 | Prelude.Double, 15 | Prelude.Either (..), 16 | Prelude.Float, 17 | Prelude.Integer, 18 | Prelude.Maybe (..), 19 | Prelude.String, 20 | 21 | -- * From "Data.Int" 22 | Data.Int.Int, 23 | Data.Int.Int8, 24 | Data.Int.Int16, 25 | Data.Int.Int32, 26 | Data.Int.Int64, 27 | 28 | -- * From "Data.Word" 29 | Data.Word.Word, 30 | Data.Word.Word8, 31 | Data.Word.Word16, 32 | Data.Word.Word32, 33 | Data.Word.Word64, 34 | 35 | -- * From "Data.Complex" 36 | Data.Complex.Complex (..), 37 | 38 | -- * From "Data.Ratio" 39 | Data.Ratio.Rational, 40 | 41 | -- * From "Numeric.Natural" 42 | Numeric.Natural.Natural, 43 | 44 | -- * From "Data.List.NonEmpty" 45 | Data.List.NonEmpty.NonEmpty (..), 46 | ) 47 | where 48 | 49 | import qualified Data.Complex 50 | import qualified Data.Int 51 | import qualified Data.List.NonEmpty 52 | import qualified Data.Ratio 53 | import qualified Data.Word 54 | import qualified Numeric.Natural 55 | import qualified Prelude 56 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.6 2 | 3 | * Restrict to min GHC 8.6 4 | * Add Contravariant 5 | * Add OverloadedLabels and Records 6 | * Add STM.orElse 7 | 8 | # 1.5 9 | 10 | * Exclude Data.Semigroup.Option 11 | * Restrict to min GHC 8.4 12 | * Add focused preludes for data types and operators 13 | 14 | # 1.4 15 | 16 | * Restrict to min GHC 8.0 and give preference to MonadFail 17 | * Add IsList, Generic1 and export all of System.IO 18 | 19 | # 1.3 20 | 21 | * Give preference to Semigroup definitions over Monoid 22 | 23 | # 1.2 24 | 25 | * Replace the `Foreign` export with `Foreign.Storable`, `Foreign.Ptr`, `Foreign.ForeignPtr`, `Foreign.StablePtr`. It's more conservative and way less likely to cause name collisions. 26 | 27 | # 1.1 28 | 29 | * Export `Foreign` 30 | 31 | # 1.0.1 32 | 33 | * Relaxed the "base" dependency 34 | 35 | # 1 36 | 37 | No changes. 38 | 39 | # 0.2 40 | 41 | * Reexported `Data.Bifunctor`. 42 | 43 | * `first` and `second` are now (conditionally) exported from `Data.Bifunctor`, not `Control.Arrow`; note that if your version of base is lower than 4.8, `first` and `second` won't be available at all. 44 | 45 | # 0.1.21 46 | 47 | * Reexported `printf` and `hPrintf` from `Text.Printf`. 48 | 49 | # 0.1.20 50 | 51 | * Reexported `Numeric`. 52 | 53 | # 0.1.19 54 | 55 | * Avoided the clash between `(&)` and `sortOn` defined in the package and versions of these functions imported from base. 56 | 57 | # 0.1.18 58 | 59 | * Added implementations of `(&)` and `sortOn` (normally not available in older versions of base). 60 | 61 | # 0.1.17 62 | 63 | * Reexported `Control.Monad.Fix`. 64 | -------------------------------------------------------------------------------- /base-prelude.cabal: -------------------------------------------------------------------------------- 1 | cabal-version: 3.0 2 | name: base-prelude 3 | version: 1.6.1.1 4 | synopsis: Featureful preludes formed solely from the "base" package 5 | description: 6 | A library which aims to reexport all the non-conflicting and 7 | most general definitions from the \"base\" package. 8 | This includes APIs for applicatives, arrows, monoids, foldables, traversables, 9 | exceptions, generics, ST, MVars and STM. 10 | This package will never have any dependencies other than \"base\". 11 | Besides a rich prelude it provides limited ones like "BasePrelude.DataTypes", 12 | which only exports the data-types defined across the \"base\" package, 13 | and "BasePrelude.Operators", which only exports the common operators. 14 | /Versioning policy/ 15 | The versioning policy of this package deviates from PVP in the sense 16 | that its exports in part are transitively determined by the version of \"base\". 17 | Therefore it's recommended for the users of \"base-prelude\" to specify 18 | the bounds of \"base\" as well. 19 | 20 | category: Prelude 21 | homepage: https://github.com/nikita-volkov/base-prelude 22 | bug-reports: https://github.com/nikita-volkov/base-prelude/issues 23 | author: Nikita Volkov 24 | maintainer: Nikita Volkov 25 | copyright: (c) 2014, Nikita Volkov 26 | license: MIT 27 | license-file: LICENSE 28 | extra-source-files: CHANGELOG.md 29 | 30 | source-repository head 31 | type: git 32 | location: git://github.com/nikita-volkov/base-prelude.git 33 | 34 | library 35 | hs-source-dirs: library 36 | default-language: Haskell2010 37 | exposed-modules: 38 | BasePrelude 39 | BasePrelude.DataTypes 40 | BasePrelude.Operators 41 | 42 | build-depends: base >=4.12 && <5 43 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: Compile, test and check the docs 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | workflow_call: 9 | 10 | jobs: 11 | 12 | format: 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v3 18 | - uses: nikita-volkov/cabal-fmt.github-action@v1.0.0 19 | - uses: nikita-volkov/ormolu.github-action@v1.0.0 20 | - name: Commit the changes 21 | uses: stefanzweifel/git-auto-commit-action@v5 22 | with: 23 | commit_message: Format 24 | 25 | build-and-test: 26 | 27 | needs: 28 | - format 29 | 30 | strategy: 31 | fail-fast: false 32 | matrix: 33 | include: 34 | - ghc: '8.8.4' 35 | - ghc: '9.6.3' 36 | - ghc: '9.8.1' 37 | ghc-options: -Werror -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wredundant-constraints -Wunused-packages -Wno-name-shadowing -Wno-unused-matches -Wno-unused-do-bind -Wno-type-defaults 38 | 39 | runs-on: ubuntu-latest 40 | 41 | steps: 42 | 43 | - uses: actions/checkout@v3 44 | 45 | - name: Setup Haskell 46 | uses: haskell-actions/setup@v2 47 | with: 48 | ghc-version: ${{ matrix.ghc }} 49 | cabal-version: 3.8 50 | 51 | - name: Generate cabal.project.freeze 52 | run: cabal freeze --enable-tests --enable-benchmarks 53 | 54 | - uses: actions/cache@v3 55 | with: 56 | path: | 57 | ~/.cabal/store 58 | key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} 59 | restore-keys: | 60 | ${{ runner.os }}-${{ matrix.ghc }}- 61 | 62 | - name: Install deps and compile 63 | run: cabal build --enable-tests -j +RTS -A128m -n2m -N -RTS --ghc-options="${{ matrix.ghc-options }}" 64 | 65 | - name: Test 66 | run: cabal test --test-show-details always 67 | 68 | - name: Run Haddock 69 | run: cabal haddock 70 | -------------------------------------------------------------------------------- /library/BasePrelude/Operators.hs: -------------------------------------------------------------------------------- 1 | -- | 2 | -- A collection of common operators provided across 3 | -- various modules of the \"base\" package. 4 | module BasePrelude.Operators 5 | ( -- * From "Control.Applicative" 6 | (Control.Applicative.*>), 7 | (Control.Applicative.<*), 8 | (Control.Applicative.<*>), 9 | (Control.Applicative.<**>), 10 | (Control.Applicative.<|>), 11 | 12 | -- * From "Control.Monad" 13 | (Control.Monad.<=<), 14 | (Control.Monad.=<<), 15 | (Control.Monad.>=>), 16 | (Control.Monad.>>), 17 | (Control.Monad.>>=), 18 | 19 | -- * From "Data.Bits" 20 | (Data.Bits..&.), 21 | (Data.Bits..|.), 22 | 23 | -- * From "Data.Bool" 24 | (Data.Bool.&&), 25 | (Data.Bool.||), 26 | (Data.Eq./=), 27 | (Data.Eq.==), 28 | 29 | -- * From "Data.Function" 30 | (Data.Function.$), 31 | (Data.Function.&), 32 | (Data.Function..), 33 | 34 | -- * From "Data.Functor" 35 | (Data.Functor.$>), 36 | (Data.Functor.<$), 37 | (Data.Functor.<$>), 38 | (Data.Functor.<&>), 39 | 40 | -- * From "Data.Functor.Contravariant" 41 | (Data.Functor.Contravariant.>$), 42 | (Data.Functor.Contravariant.>$<), 43 | (Data.Functor.Contravariant.>$$<), 44 | (Data.Functor.Contravariant.$<), 45 | 46 | -- * From "Data.Ord" 47 | (Data.Ord.<), 48 | (Data.Ord.<=), 49 | (Data.Ord.>), 50 | (Data.Ord.>=), 51 | 52 | -- * From "Data.Ratio" 53 | (Data.Ratio.%), 54 | 55 | -- * From "Data.Semigroup" 56 | (Data.Semigroup.<>), 57 | 58 | -- * From "Prelude" 59 | (Prelude.$!), 60 | (Prelude.*), 61 | (Prelude.+), 62 | (Prelude.-), 63 | (Prelude./), 64 | (Prelude.^), 65 | (Prelude.^^), 66 | ) 67 | where 68 | 69 | import qualified Control.Applicative 70 | import qualified Control.Monad 71 | import qualified Data.Bits 72 | import qualified Data.Bool 73 | import qualified Data.Eq 74 | import qualified Data.Function 75 | import qualified Data.Functor 76 | import qualified Data.Functor.Contravariant 77 | import qualified Data.Ord 78 | import qualified Data.Ratio 79 | import qualified Data.Semigroup 80 | import qualified Prelude 81 | -------------------------------------------------------------------------------- /library/BasePrelude.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -Wno-dodgy-imports -Wno-unused-imports #-} 2 | 3 | -- | 4 | -- Reexports of most of the definitions from the \"base\" package, 5 | -- which it is a common practice to import unqualified. 6 | -- 7 | -- For details check out the source. 8 | module BasePrelude 9 | ( module Exports, 10 | ) 11 | where 12 | 13 | import Control.Applicative as Exports 14 | import Control.Arrow as Exports hiding (first, second) 15 | import Control.Category as Exports 16 | import Control.Concurrent as Exports 17 | import Control.Exception as Exports 18 | import Control.Monad as Exports hiding (fail, forM, forM_, mapM, mapM_, msum, sequence, sequence_) 19 | import Control.Monad.Fail as Exports 20 | import Control.Monad.Fix as Exports hiding (fix) 21 | import Control.Monad.IO.Class as Exports 22 | import Control.Monad.ST as Exports 23 | import Data.Bifunctor as Exports 24 | import Data.Bits as Exports 25 | import Data.Bool as Exports 26 | import Data.Char as Exports 27 | import Data.Coerce as Exports 28 | import Data.Complex as Exports 29 | import Data.Data as Exports 30 | import Data.Dynamic as Exports 31 | import Data.Either as Exports 32 | import Data.Fixed as Exports 33 | import Data.Foldable as Exports hiding (toList) 34 | import Data.Function as Exports hiding (id, (.)) 35 | import Data.Functor as Exports hiding (unzip) 36 | import Data.Functor.Classes as Exports 37 | import Data.Functor.Compose as Exports 38 | import Data.Functor.Contravariant as Exports 39 | import Data.Functor.Identity as Exports 40 | import Data.IORef as Exports 41 | import Data.Int as Exports 42 | import Data.Ix as Exports 43 | import Data.List as Exports hiding (all, and, any, concat, concatMap, elem, find, foldl, foldl', foldl1, foldr, foldr1, mapAccumL, mapAccumR, maximum, maximumBy, minimum, minimumBy, notElem, or, product, sum) 44 | import Data.List.NonEmpty as Exports (NonEmpty (..)) 45 | import Data.Maybe as Exports 46 | import Data.Monoid as Exports hiding (First (..), Last (..), (<>)) 47 | import Data.Ord as Exports 48 | import Data.Proxy as Exports 49 | import Data.Ratio as Exports 50 | import Data.STRef as Exports 51 | import Data.Semigroup as Exports hiding (Option) 52 | import Data.String as Exports 53 | import Data.Traversable as Exports 54 | import Data.Tuple as Exports 55 | import Data.Unique as Exports 56 | import Data.Version as Exports 57 | import Data.Void as Exports 58 | import Data.Word as Exports 59 | import Debug.Trace as Exports 60 | import Foreign.ForeignPtr as Exports 61 | import Foreign.Ptr as Exports 62 | import Foreign.StablePtr as Exports 63 | import Foreign.Storable as Exports 64 | import GHC.Conc as Exports hiding (orElse, threadWaitRead, threadWaitReadSTM, threadWaitWrite, threadWaitWriteSTM, withMVar) 65 | import GHC.Exts as Exports (IsList (..), groupWith, inline, lazy, sortWith) 66 | import GHC.Generics as Exports (Generic, Generic1) 67 | import GHC.IO.Exception as Exports 68 | import GHC.OverloadedLabels as Exports 69 | import GHC.Records as Exports 70 | import Numeric as Exports 71 | import Numeric.Natural as Exports 72 | import System.Environment as Exports 73 | import System.Exit as Exports 74 | import System.IO as Exports 75 | import System.IO.Error as Exports 76 | import System.IO.Unsafe as Exports 77 | import System.Mem as Exports 78 | import System.Mem.StableName as Exports 79 | import System.Timeout as Exports 80 | import Text.ParserCombinators.ReadP as Exports (ReadP, ReadS, readP_to_S, readS_to_P) 81 | import Text.ParserCombinators.ReadPrec as Exports (ReadPrec, readP_to_Prec, readPrec_to_P, readPrec_to_S, readS_to_Prec) 82 | import Text.Printf as Exports (hPrintf, printf) 83 | import Text.Read as Exports (Read (..), readEither, readMaybe) 84 | import Unsafe.Coerce as Exports 85 | import Prelude as Exports hiding (all, and, any, concat, concatMap, elem, fail, foldl, foldl1, foldr, foldr1, id, mapM, mapM_, maximum, minimum, notElem, or, product, sequence, sequence_, sum, (.)) 86 | --------------------------------------------------------------------------------