Skip to content

Commit cf6e314

Browse files
authored
Merge pull request #27 from serokell/gromak/ghc-9.8
Support GHC-9.8
2 parents 1c72974 + fbded8b commit cf6e314

File tree

9 files changed

+37
-63
lines changed

9 files changed

+37
-63
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
# Changelog
22

33

4+
## 1.1.0.0
5+
6+
### Changed
7+
8+
- Allow newer versions of base and text to support GHC up to 9.8.
9+
- Deprecate Data.Text.IO.Utf8.
10+
11+
412
## 1.0.2.4
513

614
### Changed
715

816
- Allow base 4.17, 4.18 (GHC 9.4, 9.6).
917
- Allow text<2.1
1018

11-
## 1.0.2.2
1219

1320
## 1.0.2.3
1421

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ error due to encoding issues.
4545
If you are going to read a text file (to be precise, if you are going to open
4646
a file in text mode), you’ll probably use `withFile`, `openFile`, or `readFile`.
4747
Grab the first two from `System.IO.Utf8` or the latter from `Data.Text.IO.Utf8`.
48+
Starting from `text-2.1`, `Data.Text.IO.Utf8` is available in the `text` package
49+
itself, hence this module in `with-utf8` is now deprecated.
4850

4951
_Note: it is best to import these modules qualified._
5052

51-
_Note: there is no `System.IO.Utf8.readFile` because it’s 2020 and
53+
_Note: there is no `System.IO.Utf8.readFile` because it’s 2024 and
5254
you should not read `String`s from files._
5355

5456
All these functions will make sure that the content will be treated as if it
@@ -72,6 +74,8 @@ doSomethingWithAFile h = Utf8.withhandle h $ do
7274
When writing a file either open it using `withFile`/`openFile` from
7375
`System.IO.Utf8` or write to it directly with `writeFile` from
7476
`Data.Text.IO.Utf8`.
77+
Starting from `text-2.1`, `Data.Text.IO.Utf8` is available in the `text` package
78+
itself, hence this module in `with-utf8` is now deprecated.
7579

7680
_Note: it is best to import these modules qualified._
7781

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
hs-package-name = "with-utf8";
4040

41-
ghc-versions = [ "884" "8107" "902" "928" "948" ];
41+
ghc-versions = [ "884" "8107" "902" "928" "948" "963" "981" ];
4242

4343
# invoke haskell.nix for each ghc version listed in ghc-versions
4444
pkgs-per-ghc = lib.genAttrs (map (v: "ghc${v}") ghc-versions)

lib/Data/Text/IO/Utf8.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
-- Wrappers around simple file reading/writing functions from the
99
-- @text@ package that reset the handle encoding to UTF-8.
1010
module Data.Text.IO.Utf8
11+
{-# DEPRECATED "Use Data.Text.IO.Utf8 from the text package instead" #-}
1112
( readFile
1213
, writeFile
1314
) where

package.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: MPL-2.0
44

55
name: with-utf8
6-
version: 1.0.2.4
6+
version: 1.1.0.0
77
synopsis: Get your IO right on the first try
88
description: |
99
This minimalistic library helps you navigate the world of text encodings
@@ -37,8 +37,8 @@ ghc-options:
3737
- -Wredundant-constraints
3838

3939
dependencies:
40-
- base >= 4.10 && < 4.19
41-
- text >= 0.7 && < 2.1
40+
- base >= 4.10 && < 4.20
41+
- text >= 0.7 && < 2.2
4242

4343
library:
4444
source-dirs: lib

stack.yaml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,5 @@
22
#
33
# SPDX-License-Identifier: MPL-2.0
44

5-
resolver: lts-18.14
5+
resolver: lts-22.5
66
packages: [.]
7-
8-
extra-deps:
9-
# Required for GHC >= 9
10-
- th-env-0.1.0.3
11-
12-
# Required for GHC >= 9.2
13-
- constraints-0.13.1
14-
- hashable-1.3.5.0
15-
- random-1.2.1
16-
17-
# text-2.0
18-
#- hashable-1.4.0.1
19-
#- text-2.0
20-
21-
#allow-newer: true # text-2.0: some of our deps (incorrectly) say they don’t like it

stack.yaml.lock

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,10 @@
33
# For more information, please see the documentation at:
44
# https://docs.haskellstack.org/en/stable/lock_files
55

6-
packages:
7-
- completed:
8-
hackage: th-env-0.1.0.3@sha256:3804eeff3edf8b4c3c6ca68a8b4eff3bf23c07c468c699e3f010c4dec1603830,1386
9-
pantry-tree:
10-
size: 370
11-
sha256: f14846f743126dde54c05cb7eb3038b059bec372532582858ca982bdebef0bad
12-
original:
13-
hackage: th-env-0.1.0.3
14-
- completed:
15-
hackage: constraints-0.13.1@sha256:3d2002767a32e0c0ea156276c34de926875817c4db385d8e75776b6e35b0267d,2396
16-
pantry-tree:
17-
size: 867
18-
sha256: a4d80e46d52971b0f74051c3cc2a7e87408b6e1e19b5fb4814360441c9e524a0
19-
original:
20-
hackage: constraints-0.13.1
21-
- completed:
22-
hackage: hashable-1.3.5.0@sha256:47d1232d9788bb909cfbd80618de18dcdfb925609593e202912bd5841db138c1,4193
23-
pantry-tree:
24-
size: 1248
25-
sha256: adde5ecc080faa094750544837937cf876e65bf5bf28d81db22e7401faa46bf3
26-
original:
27-
hackage: hashable-1.3.5.0
28-
- completed:
29-
hackage: random-1.2.1@sha256:8bee24dc0c985a90ee78d94c61f8aed21c49633686f0f1c14c5078d818ee43a2,6598
30-
pantry-tree:
31-
size: 1528
32-
sha256: 8bdc994ce41f43624ab42302a881fe5a0f81d965f5d238841e24943664681a06
33-
original:
34-
hackage: random-1.2.1
6+
packages: []
357
snapshots:
368
- completed:
37-
size: 586069
38-
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/14.yaml
39-
sha256: 87842ecbaa8ca9cee59a7e6be52369dbed82ed075cb4e0d152614a627e8fd488
40-
original: lts-18.14
9+
sha256: 90e6fcdcf6706918ef022ab01214828c550ee637a2d50f4fe96b15742b8bced1
10+
size: 714102
11+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/5.yaml
12+
original: lts-22.5

test/Test/Utf8/ReadWrite.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55

66
{-# LANGUAGE LambdaCase #-}
77
{-# LANGUAGE OverloadedStrings #-}
8+
{-# LANGUAGE PackageImports #-}
89
{-# LANGUAGE ScopedTypeVariables #-}
910

11+
-- Due to our Data.Text.IO.Utf8 which is deprecated and
12+
-- will be removed later.
13+
{-# OPTIONS_GHC -fno-warn-deprecations #-}
14+
1015
module Test.Utf8.ReadWrite where
1116

1217
import Control.DeepSeq (force)
@@ -22,7 +27,7 @@ import Hedgehog (Property, forAll, property, (===))
2227
import Test.HUnit (Assertion, assertFailure)
2328

2429
import qualified Data.Text.IO as T
25-
import qualified Data.Text.IO.Utf8 as Utf8
30+
import qualified "with-utf8" Data.Text.IO.Utf8 as Utf8
2631
import qualified System.IO as IO
2732
import qualified System.IO.Utf8 as Utf8
2833

with-utf8.cabal

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cabal-version: 1.18
55
-- see: https://github.com/sol/hpack
66

77
name: with-utf8
8-
version: 1.0.2.4
8+
version: 1.1.0.0
99
synopsis: Get your IO right on the first try
1010
description: This minimalistic library helps you navigate the world of text encodings
1111
avoiding @invalid argument (invalid byte sequence)@
@@ -48,9 +48,9 @@ library
4848
lib
4949
ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints
5050
build-depends:
51-
base >=4.10 && <4.19
51+
base >=4.10 && <4.20
5252
, safe-exceptions ==0.1.*
53-
, text >=0.7 && <2.1
53+
, text >=0.7 && <2.2
5454
default-language: Haskell2010
5555

5656
executable utf8-troubleshoot
@@ -63,12 +63,12 @@ executable utf8-troubleshoot
6363
c-sources:
6464
app/utf8-troubleshoot/cbits/locale.c
6565
build-depends:
66-
base >=4.10 && <4.19
66+
base >=4.10 && <4.20
6767
, directory >=1.2.5.0 && <1.4
6868
, filepath >=1.0 && <1.5
6969
, process >=1.0.1.1 && <1.7
7070
, safe-exceptions
71-
, text >=0.7 && <2.1
71+
, text >=0.7 && <2.2
7272
, th-env >=0.1.0.0 && <0.2
7373
default-language: Haskell2010
7474

@@ -89,15 +89,15 @@ test-suite with-utf8-test
8989
tasty-discover:tasty-discover
9090
build-depends:
9191
HUnit
92-
, base >=4.10 && <4.19
92+
, base >=4.10 && <4.20
9393
, deepseq
9494
, hedgehog
9595
, safe-exceptions
9696
, tasty
9797
, tasty-hedgehog
9898
, tasty-hunit
9999
, temporary
100-
, text >=0.7 && <2.1
100+
, text >=0.7 && <2.2
101101
, unix
102102
, with-utf8
103103
default-language: Haskell2010

0 commit comments

Comments
 (0)