-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: in some projects, like `xrefcheck`, we would like to use `universum` without constant explicit `import Universum`. Solution: add a dedicated package that allows doing so. One another way is using mixins feature, but it does not yet work really well (`stack ghci` tends to fail, as well as Haskell language server), so we better look at this feature again at its better times.
- Loading branch information
1 parent
b640ec3
commit 1d1347d
Showing
8 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
0.1 | ||
===== | ||
|
||
* Initial release. | ||
Providing `Prelude` and `Unsafe` modules. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
Copyright (c) 2021 Serokell | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to | ||
deal in the Software without restriction, including without limitation the | ||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
sell copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Universum-prelude | ||
================= | ||
|
||
For medium-sized projects, it is tedious to write `import Universum` in every single module, while switching to a project-custom prelude may be not yet desired. | ||
|
||
This package re-exports `Universum` module as `Prelude`, effectively allowing implicit import of universum. | ||
When adding a dependncy on `universum-prelude` to your project, you will need to replace `base` dependency with `base-noprelude` to avoid conflicts. | ||
|
||
Additionally, `Universum.Unsafe` is re-exported as `Unsafe` module. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Prelude | ||
( module Universum | ||
) where | ||
|
||
import Universum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Unsafe | ||
( module Universum.Unsafe | ||
) where | ||
|
||
import Universum.Unsafe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
cabal-version: 2.2 | ||
name: universum-prelude | ||
version: 1.0 | ||
synopsis: Allows implicit Universum importing. | ||
description: This package exports Prelude module that is just a re-export of Universum. | ||
Can be used with base-noprelude package to implicitly import Universum. | ||
Most suitable for medium-sized projects. | ||
homepage: https://github.com/serokell/universum | ||
license: MIT | ||
license-file: LICENSE | ||
author: @serokell | ||
maintainer: Serokell <[email protected]> | ||
copyright: 2021 Serokell | ||
category: Prelude | ||
stability: stable | ||
build-type: Simple | ||
bug-reports: https://github.com/serokell/universum/issues | ||
extra-doc-files: CHANGES.md | ||
, README.md | ||
|
||
source-repository head | ||
type: git | ||
location: [email protected]:serokell/universum.git | ||
|
||
common common-options | ||
build-depends: base >= 4.8 && < 5 | ||
ghc-options: | ||
-- Source: https://medium.com/mercury-bank/enable-all-the-warnings-a0517bc081c3 | ||
-Weverything | ||
-Wno-missing-exported-signatures | ||
-Wno-missing-import-lists | ||
-Wno-missed-specialisations | ||
-Wno-all-missed-specialisations | ||
-Wno-unsafe | ||
-Wno-safe | ||
-Wno-missing-local-signatures | ||
-Wno-monomorphism-restriction | ||
-Wno-implicit-prelude | ||
if impl(ghc >= 8.10.1) | ||
ghc-options: -Wno-prepositive-qualified-module | ||
-Wno-inferred-safe-imports | ||
|
||
default-language: Haskell2010 | ||
|
||
library | ||
import: common-options | ||
hs-source-dirs: src | ||
exposed-modules: | ||
Prelude | ||
Unsafe | ||
|
||
build-depends: universum | ||
ghc-options: -Wimplicit-prelude | ||
default-extensions: NoImplicitPrelude |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
resolver: lts-15.11 | ||
|
||
packages: | ||
- . | ||
- prelude |