with-utf8 1.0.2.4 → 1.1.0.0
raw patch · 6 files changed
+31/−12 lines, 6 filesdep ~basedep ~filepathdep ~text
Dependency ranges changed: base, filepath, text
Files
- CHANGELOG.md +8/−1
- README.md +5/−1
- app/utf8-troubleshoot/Main.hs +4/−2
- lib/Data/Text/IO/Utf8.hs +1/−0
- test/Test/Utf8/ReadWrite.hs +6/−1
- with-utf8.cabal +7/−7
CHANGELOG.md view
@@ -1,6 +1,14 @@ # 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@@ -8,7 +16,6 @@ - Allow base 4.17, 4.18 (GHC 9.4, 9.6). - Allow text<2.1 -## 1.0.2.2 ## 1.0.2.3
README.md view
@@ -45,10 +45,12 @@ 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@@ -72,6 +74,8 @@ 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._
app/utf8-troubleshoot/Main.hs view
@@ -40,6 +40,8 @@ import qualified Prelude as P +-- See https://github.com/ndmitchell/hlint/commit/505a4d57b972f3ba605ad7a59721cef1f3d98a84+{-# ANN module "HLint: ignore Unused LANGUAGE pragma" #-} -- | Encode a 'String' to be safe to print in ASCII-only. protect :: String -> String@@ -70,10 +72,10 @@ showEnvVar "TERM" -- Nix stuff- let builtNix = isJust ($$(envQ @String "NIX_BUILD_TOP"))+ let builtNix = isJust $$(envQ @String "NIX_BUILD_TOP") when builtNix $ do putStrLn " * Built with Nix"- let builtNixShell = isJust ($$(envQ @String "IN_NIX_SHELL"))+ let builtNixShell = isJust $$(envQ @String "IN_NIX_SHELL") when builtNixShell $ do putStrLn " * Built in nix-shell" inNixShell <- isJust <$> lookupEnv "IN_NIX_SHELL"
lib/Data/Text/IO/Utf8.hs view
@@ -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
test/Test/Utf8/ReadWrite.hs view
@@ -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)@@ -22,7 +27,7 @@ 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
with-utf8.cabal view
@@ -5,7 +5,7 @@ -- 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)@@@ -48,9 +48,9 @@ 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@@ -63,12 +63,12 @@ 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 @@ -89,7 +89,7 @@ tasty-discover:tasty-discover build-depends: HUnit- , base >=4.10 && <4.19+ , base >=4.10 && <4.20 , deepseq , hedgehog , safe-exceptions@@ -97,7 +97,7 @@ , tasty-hedgehog , tasty-hunit , temporary- , text >=0.7 && <2.1+ , text >=0.7 && <2.2 , unix , with-utf8 default-language: Haskell2010