Skip to content

Commit 4439813

Browse files
committed
Relax base's bounds to allow GHC 9.0
1 parent 211e90f commit 4439813

File tree

8 files changed

+15
-48
lines changed

8 files changed

+15
-48
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ jobs:
7373
- name: Running hlint
7474
run: nix-shell --pure -I ${{ env.NIX_PATH }} --argstr ghcVersion ${{env.GHC}} --run './.github/workflows/hlint-runner.sh' .github/workflows/shell.nix
7575

76-
- name: Running stylish-haskell
77-
run: nix-shell --pure -I ${{ env.NIX_PATH }} --argstr ghcVersion ${{env.GHC}} --run './.github/workflows/stylish-haskell-runner.sh' .github/workflows/shell.nix
78-
7976
- name: Build
8077
run: nix-shell --pure -I ${{ env.NIX_PATH }} --argstr ghcVersion ${{env.GHC}} --run 'make build' .github/workflows/shell.nix
8178

.github/workflows/deploy-docs.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/shell.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ in with pkgs;
88
cabal-install
99
hlint
1010
haskellPackages.apply-refact
11-
stylish-haskell
1211

1312
# DB Deps
1413
postgresql_13
@@ -19,7 +18,6 @@ in with pkgs;
1918
# Extra
2019
parallel
2120
git
22-
# mkdocs
2321
gnumake
2422
];
2523
shellHook = ''

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ test: ## Run the test suite
1616
lint: ## Run the code linter (HLint)
1717
@find test src -name "*.hs" | parallel -j $(PROCS) -- hlint --refactor-options="-i" --refactor {}
1818

19-
style: ## Run the code styler (stylish-haskell)
20-
@stylish-haskell -i -r src test
21-
2219
help:
2320
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.* ?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
2421

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Display [![CI-badge][CI-badge]][CI-url] ![simple-haskell][simple-haskell]
1+
# Display [![CI-badge][CI-badge]][CI-url]
22

33
_A Typeclass for user-facing output_
44

@@ -7,8 +7,6 @@ _A Typeclass for user-facing output_
77
The `display` library offers a way for developers to print a textual representation of datatypes that does not
88
have to abide by the rules of the [Show typeclass][Show].
99

10-
If you need some more instances from `base` or
11-
1210
## Examples
1311

1412
There are two methods to implement `Display` for your type:
@@ -75,8 +73,6 @@ As such, in order to avoid dangerously blind conversions, it is recommended to u
7573
function such as `decodeUtf8` or `decodeUtf8Strict` if you wish to turn a UTF8-encoded ByteString
7674
to Text.
7775
78-
79-
[simple-haskell]: https://img.shields.io/badge/Simple-Haskell-purple?style=flat-square
8076
[Show]: https://hackage.haskell.org/package/base/docs/Text-Show.html#v:Show
8177
[CI-badge]: https://img.shields.io/github/workflow/status/Kleidukos/display/CI?style=flat-square
8278
[CI-url]: https://github.com/Kleidukos/display/actions

display.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ library
4141
hs-source-dirs: src
4242
exposed-modules: Data.Text.Display
4343
build-depends:
44-
, base ^>=4.14
44+
, base >= 4.12 && <= 4.16
4545
, bytestring ^>=0.11
4646
, text ^>=1.2
4747

src/Data/Text/Display.hs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE DataKinds #-}
2-
{-# LANGUAGE DerivingStrategies #-}
2+
33
{-# LANGUAGE DerivingVia #-}
44
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
55
{-# LANGUAGE OverloadedStrings #-}
@@ -30,6 +30,7 @@ module Data.Text.Display
3030
import Control.Exception hiding (TypeError)
3131
import Data.ByteString
3232
import qualified Data.ByteString.Lazy as BL
33+
import Data.Foldable (foldMap')
3334
import Data.Int
3435
import Data.Kind
3536
import Data.List.NonEmpty
@@ -38,7 +39,6 @@ import qualified Data.Text as T
3839
import qualified Data.Text.Lazy as TL
3940
import Data.Word
4041
import GHC.TypeLits
41-
import Data.Foldable (foldMap')
4242

4343
-- | A typeclass for user-facing output.
4444
--
@@ -89,7 +89,7 @@ class Display a where
8989
displayList (x:xs) = displayList' xs ("[" <> display x)
9090
where
9191
displayList' :: Display a => [a] -> Text -> Text
92-
displayList' [] acc = acc <> "]"
92+
displayList' [] acc = acc <> "]"
9393
displayList' (y:ys) acc = displayList' ys (acc <> "," <> display y)
9494

9595
-- | 🚫 You should not derive Display for function types!
@@ -149,10 +149,11 @@ type family CannotDisplayByteStrings :: Constraint where
149149
-- > via (ShowInstance AutomaticallyDerived)
150150
--
151151
-- @since 0.0.1.0
152-
newtype (Show e) => ShowInstance e
152+
newtype ShowInstance e
153153
= ShowInstance e
154-
deriving newtype ( Show -- ^ @since 0.0.1.0
155-
)
154+
deriving newtype
155+
( Show -- ^ @since 0.0.1.0
156+
)
156157

157158
-- | This wrapper allows you to rely on a pre-existing 'Show' instance in order to derive 'Display' from it.
158159
--
@@ -199,7 +200,7 @@ instance Display a => Display (NonEmpty a) where
199200

200201
-- | @since 0.0.1.0
201202
instance Display a => Display (Maybe a) where
202-
display Nothing = T.pack "Nothing"
203+
display Nothing = T.pack "Nothing"
203204
display (Just a) = T.pack "Just " <> display a
204205

205206
-- | @since 0.0.1.0

test/Main.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
{-# LANGUAGE DerivingStrategies #-}
2-
{-# LANGUAGE TypeApplications #-}
1+
32
{-# LANGUAGE DerivingVia #-}
43
{-# LANGUAGE OverloadedStrings #-}
4+
{-# LANGUAGE TypeApplications #-}
55

66
module Main where
77

8+
import Data.List.NonEmpty
9+
import qualified Data.List.NonEmpty as NE
810
import Data.Text (Text)
911
import qualified Data.Text as T
10-
import qualified Data.List.NonEmpty as NE
11-
import Data.List.NonEmpty
1212
import Test.Hspec
1313

1414
import Data.Text.Display
1515

1616
main :: IO ()
1717
main = hspec spec
1818

19-
data AutomaticallyDerived = AD
20-
deriving stock (Show)
19+
data AutomaticallyDerived = AD deriving stock (Show)
2120
deriving (Display)
2221
via (ShowInstance AutomaticallyDerived)
2322

0 commit comments

Comments
 (0)