Skip to content

Commit

Permalink
Merge pull request #27 from serokell/gromak/ghc-9.8
Browse files Browse the repository at this point in the history
Support GHC-9.8
  • Loading branch information
gromakovsky authored Jan 17, 2024
2 parents 1c72974 + fbded8b commit cf6e314
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 63 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# Changelog


## 1.1.0.0

### Changed

- Allow newer versions of base and text to support GHC up to 9.8.
- Deprecate Data.Text.IO.Utf8.


## 1.0.2.4

### Changed

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

## 1.0.2.2

## 1.0.2.3

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ error due to encoding issues.
If you are going to read a text file (to be precise, if you are going to open
a file in text mode), you’ll probably use `withFile`, `openFile`, or `readFile`.
Grab the first two from `System.IO.Utf8` or the latter from `Data.Text.IO.Utf8`.
Starting from `text-2.1`, `Data.Text.IO.Utf8` is available in the `text` package
itself, hence this module in `with-utf8` is now deprecated.

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

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

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

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

# invoke haskell.nix for each ghc version listed in ghc-versions
pkgs-per-ghc = lib.genAttrs (map (v: "ghc${v}") ghc-versions)
Expand Down
1 change: 1 addition & 0 deletions lib/Data/Text/IO/Utf8.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-- Wrappers around simple file reading/writing functions from the
-- @text@ package that reset the handle encoding to UTF-8.
module Data.Text.IO.Utf8
{-# DEPRECATED "Use Data.Text.IO.Utf8 from the text package instead" #-}
( readFile
, writeFile
) where
Expand Down
6 changes: 3 additions & 3 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MPL-2.0

name: with-utf8
version: 1.0.2.4
version: 1.1.0.0
synopsis: Get your IO right on the first try
description: |
This minimalistic library helps you navigate the world of text encodings
Expand Down Expand Up @@ -37,8 +37,8 @@ ghc-options:
- -Wredundant-constraints

dependencies:
- base >= 4.10 && < 4.19
- text >= 0.7 && < 2.1
- base >= 4.10 && < 4.20
- text >= 0.7 && < 2.2

library:
source-dirs: lib
Expand Down
17 changes: 1 addition & 16 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,5 @@
#
# SPDX-License-Identifier: MPL-2.0

resolver: lts-18.14
resolver: lts-22.5
packages: [.]

extra-deps:
# Required for GHC >= 9
- th-env-0.1.0.3

# Required for GHC >= 9.2
- constraints-0.13.1
- hashable-1.3.5.0
- random-1.2.1

# text-2.0
#- hashable-1.4.0.1
#- text-2.0

#allow-newer: true # text-2.0: some of our deps (incorrectly) say they don’t like it
38 changes: 5 additions & 33 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,10 @@
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files

packages:
- completed:
hackage: th-env-0.1.0.3@sha256:3804eeff3edf8b4c3c6ca68a8b4eff3bf23c07c468c699e3f010c4dec1603830,1386
pantry-tree:
size: 370
sha256: f14846f743126dde54c05cb7eb3038b059bec372532582858ca982bdebef0bad
original:
hackage: th-env-0.1.0.3
- completed:
hackage: constraints-0.13.1@sha256:3d2002767a32e0c0ea156276c34de926875817c4db385d8e75776b6e35b0267d,2396
pantry-tree:
size: 867
sha256: a4d80e46d52971b0f74051c3cc2a7e87408b6e1e19b5fb4814360441c9e524a0
original:
hackage: constraints-0.13.1
- completed:
hackage: hashable-1.3.5.0@sha256:47d1232d9788bb909cfbd80618de18dcdfb925609593e202912bd5841db138c1,4193
pantry-tree:
size: 1248
sha256: adde5ecc080faa094750544837937cf876e65bf5bf28d81db22e7401faa46bf3
original:
hackage: hashable-1.3.5.0
- completed:
hackage: random-1.2.1@sha256:8bee24dc0c985a90ee78d94c61f8aed21c49633686f0f1c14c5078d818ee43a2,6598
pantry-tree:
size: 1528
sha256: 8bdc994ce41f43624ab42302a881fe5a0f81d965f5d238841e24943664681a06
original:
hackage: random-1.2.1
packages: []
snapshots:
- completed:
size: 586069
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/14.yaml
sha256: 87842ecbaa8ca9cee59a7e6be52369dbed82ed075cb4e0d152614a627e8fd488
original: lts-18.14
sha256: 90e6fcdcf6706918ef022ab01214828c550ee637a2d50f4fe96b15742b8bced1
size: 714102
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/5.yaml
original: lts-22.5
7 changes: 6 additions & 1 deletion test/Test/Utf8/ReadWrite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@

{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE ScopedTypeVariables #-}

-- Due to our Data.Text.IO.Utf8 which is deprecated and
-- will be removed later.
{-# OPTIONS_GHC -fno-warn-deprecations #-}

module Test.Utf8.ReadWrite where

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

import qualified Data.Text.IO as T
import qualified Data.Text.IO.Utf8 as Utf8
import qualified "with-utf8" Data.Text.IO.Utf8 as Utf8
import qualified System.IO as IO
import qualified System.IO.Utf8 as Utf8

Expand Down
14 changes: 7 additions & 7 deletions with-utf8.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.18
-- see: https://github.com/sol/hpack

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

executable utf8-troubleshoot
Expand All @@ -63,12 +63,12 @@ executable utf8-troubleshoot
c-sources:
app/utf8-troubleshoot/cbits/locale.c
build-depends:
base >=4.10 && <4.19
base >=4.10 && <4.20
, directory >=1.2.5.0 && <1.4
, filepath >=1.0 && <1.5
, process >=1.0.1.1 && <1.7
, safe-exceptions
, text >=0.7 && <2.1
, text >=0.7 && <2.2
, th-env >=0.1.0.0 && <0.2
default-language: Haskell2010

Expand All @@ -89,15 +89,15 @@ test-suite with-utf8-test
tasty-discover:tasty-discover
build-depends:
HUnit
, base >=4.10 && <4.19
, base >=4.10 && <4.20
, deepseq
, hedgehog
, safe-exceptions
, tasty
, tasty-hedgehog
, tasty-hunit
, temporary
, text >=0.7 && <2.1
, text >=0.7 && <2.2
, unix
, with-utf8
default-language: Haskell2010

0 comments on commit cf6e314

Please sign in to comment.